1.0.2 • Published 7 years ago
frivillig-logger v1.0.2
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']
toproduction
, thenlogger.debug
will not work. - Set
process.env['NODE_ENV']
totest
, then onlylogger.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 });