1.0.11 • Published 2 years ago

@bolt.tech/logger v1.0.11

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
2 years ago

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.ts file 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.

  1. emit is a general method which is to be used to emit any logs to Fluent-Bit. emit takes three arguments, label, event and bypassLocal. bypassLocal is default true. In case you want to print any emit events when running locally, you can set this to false to print logs on your local console.

  2. emitRequestLog is used to emit a specific log to capture response and trace the incoming request.

  3. emitDebugLog is used to emit debug logs. This is to replace the console.log and trace all logs on ES.

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago