@bolt.tech/logger v1.1.1
BOLT.EARTH Logger
This is an internal module of BOLT.EARTH for remote logs routing via fluent bit.
Installation
npm i --save @bolt.tech/logger
Initialise Logger
Create a
logger.tsfile and paste below template to initialise your logger.
import * as dotenv from "dotenv";
dotenv.config();
import Logger from "@bolt.tech/logger";
const logger = new Logger(process.env.PARAMSTORE_PATH, process.env.NODE_ENV_LOCAL, tag);
export { logger };Class Logger takes three arguments as inputs, paramstorePath, isLocal and tag.
paramstorePath can be dev, preprod or prod.
If isLocal is "TRUE", then the logger would by default skip all the emit events.
Basic Usage
Class Logger has public methods specific to certain use cases.
emitis a general method which is to be used to emit any logs to Fluent-Bit.emittakes three arguments,label,eventandbypassLocal.bypassLocalis default true. In case you want to print any emit events when running locally, you can set this tofalseto print logs on your local console.emitRequestLogis used to emit a specific log to capture response and trace the incoming request.emitDebugLogis used to emit debug logs. This is to replace the console.log and trace all logs on ES.