DIVA.EXCHANGE generic logger - pino-based. NPM package.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Konrad Bächler ab7cc4a754 v1.0.0 1 month ago
src version bump, fixed log level default in production (info) 1 month ago
test bug fix: esm related module loading, updated unit tests 11 months ago
.eslintrc.json fixed linting 11 months ago
.gitignore Initial commit 11 months ago
LICENSE initial 11 months ago
README.md fixed scope 4 months ago
index.js bug fix: esm related module loading, updated unit tests 11 months ago
package-lock.json v1.0.0 1 month ago
package.json v1.0.0 1 month ago


Modern, fast and lightweight Logger

Modern, fast, lightweight and generic logger. It’s based on pino (https://www.npmjs.com/package/pino).

How to Install

npm install @diva.exchange/diva-logger

Getting Started - Usage

Use it either as

import { Logger } from '@diva.exchange/diva-logger'

Logger.trace('hello world')


const Logger = require('@diva.exchange/diva-logger')

Logger.trace('hello world')


diva-logger is static. It can be used without instantiation, like

import { Logger } from '@diva.exchange/diva-logger' 

try  {
    throw new Error('A recoverable error')
} catch (error) {
    // go on

diva-logger also attaches itself gently to the two global events uncaughtException and unhandledRejection. Hence an unhandled exception or an unhandled rejected promise will be properly logged (fatal):

import { Logger } from '@diva.exchange/diva-logger' 

throw new Error('This is fatal')

After an unhandled exception or unhandled rejected promise, the process will be terminated with the exit code 1 (after the remaining event stack has been processed).


diva-logger supports chaining, like

Logger.trace('trace message').debug('debug message')

Logging Examples, Usage of API

trace(any[, options])

Logger.trace('some trace message')

debug(any[, options])


info(any[, options])

Logger.info('info goes here')

warn(any[, options])

Logger.warn('warning - recoverable error')

error(any[, options])

Logger.error('some serious error')

fatal(any[, options])

Logger.fatal('One of the last messages of the process...')

How to Run Unit Tests

npm run test

Coverage reports are stored within ./coverage. Use any browser and open ./coverage/index.html.

How to Lint (eslint)

npm run lint