loggry
TypeScript icon, indicating that this package has built-in type declarations

0.3.57 • Public • Published

LOGGRY

Lightweight 0-dependency, transport agnostic, ESM and CommonJS NodeJS logger bus

Build Status NPM version Downloads Coverage Status Maintainability Snyk

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

Package Sidebar

Install

npm i loggry

Weekly Downloads

0

Version

0.3.57

License

Apache-2.0

Unpacked Size

25.6 kB

Total Files

9

Last publish

Collaborators

  • 3axap4ehko