@netizen-experience/logger
v0.1.1
Published
This library provides a structured logging utility using [Winston](https://github.com/winstonjs/winston).
Readme
Logger
This library provides a structured logging utility using Winston.
Table of Contents
Installation
To install the package, run:
npm install @netizen-experience/loggerUsage and Examples
First, initialize the logger:
import { initLogger } from "logger";
const log = initLogger();Then, use the logger to log messages at the default info log level.
log({ message: "info", session: "abcdef123456", origin: ["user", "getProfile"] });You can also use the logger to log messages at different logger levels:
log.error(new Error("Error message"));
log.debug({ message: "debug", session: "abcdef123456", origin: ["user", "userLookupFromIdentity"] });Configuration
You can configure the logger using environment variables:
LOGGER_LEVEL: Sets the logging level (e.g.,info,debug,error). Default isinfo.
