LOGGRY
Lightweight 0-dependency, transport agnostic, ESM and CommonJS NodeJS logger bus
Instalation
YARN
yarn add loggry
NPM
npm install --save loggry
Usage
In the main script
import { addListener, LogEvent } from 'loggry';
addListener((log: LogEvent) => console.log(log.level, log.message, 'at', log.timestamp));
In some other place
import { debug } from 'loggry';
function myFunction() {
debug('myFunction', 'executed!');
}
Built-in log levels
enum LogLevel {
silent,
fatal,
error,
warn,
info,
debug,
trace,
}
Pino integration
import createPino from 'pino';
import { addListener, LogEvent } from 'loggry';
const pinoLogger = createPino();
addListener(({ level, message, details }: LogEvent) => pinoLogger[level]({ details }, message));
License
License Apache-2.0 Copyright (c) 2023 Ivan Zakharchanka