@webbio/webbalert-logging
v1.0.1
Published
Base logging library for Webbio's web applications
Downloads
3
Maintainers
Keywords
Readme
WebbAlert Logging package
Base package that allows for logging to multiple providers.
Installation
Frontend installation:
npm install @webbio/webbalert-logging @webbio/webbalert-provider-apm-rum
Node.JS installation
npm install @webbio/webbalert-logging @webbio/webbalert-provider-apm-node
Usage
Step 1: Register one or multiple providers using:
import Logger, { ConsoleProvider } from "@webbio/webbalert-logging";
import ProviderApmRum from "@webbio/webbalert-provider-apm-rum";
Logger.registerProviders([
new ConsoleProvider(),
new ProviderApmRum({
serviceName,
serviceVersion,
serverUrl: "INSERT_APM_SERVER_URL",
}),
]);
The above example will log errors to the console and to APM Server (Elastic Cloud) from a frontend service.
Step 2: Log an error message from anywhere in the service:
import Logger from "@webbio/webbalert-logging";
Logger.log(new Error("This is a Javascript error"));