frivillig-logger

1.0.2 • Public • Published

Simple logging module

Easier logging!

Summary

Simple logging module. Uses Pino. Read more in Pino's documentation. This module simply wraps calls to the corresponding Pino call, i.e. logger.info(args) calls pino.info(args).

Environment variables

This module reads process.env['NODE_ENV'] to determine whether it should log or not.

  • Set process.env['NODE_ENV'] to production, then logger.debug will not work.
  • Set process.env['NODE_ENV'] to test, then only logger.debug will work.

Pino config

The first argument passed to frivillig-logger will be passed as config to Pino. To see which config options you have, go to Pino's own documentation.

Example usage

Below is a short example of how you can use this module.

const logger = require('frivillig-logger')({
  level: 'debug',
  name: 'my-application'
});
 
logger('message', { foo: bar });
logger.info('message', { foo: bar });
logger.error(error);
logger.trace('message', { foo: bar });
logger.debug('message', { foo: bar });

Package Sidebar

Install

npm i frivillig-logger

Weekly Downloads

2

Version

1.0.2

License

ISC

Last publish

Collaborators

  • frivillig.no