A small wrapper around the Winston loggly library.
NOTE: this library is not very customizable nor will it be, its intent is to serve as a standard for my projects.
npm install --save @nielskrijger/logger
Use the library like this:
import log from '@nielskrijger/logger';
log.init({
console: {
level: 'debug',
colorize: true,
},
loggly: {
level: 'info',
subdomain: 'test',
token: '99f026e6-fb0b-443c-8b1b-c6e666f5a6c1',
tags: ['my-domain'],
},
});
log.debug('Debug this', { object: 'value' });
log.info('Starting server');
log.warn('Watch out!');
log.error('Error', { test: 'Extra properties!' });
Options
console.level
: possible valuesnone
,debug
,info
,warn
,error
. To disable all logging set tonone
. Defaultnone
.console.colorize
: enable/disable colors in console output. Defaulttrue
.loggly.level
: possible valuesnone
,debug
,info
,warn
,error
. To disable all logging set tonone
. Defaultnone
.loggly.token
: the Loggly token, required whenloggly.level !== 'none'
.loggly.subdomain
: the Loggly subdomain, required whenloggly.level !== 'none'
.loggly.tags
: tags added to the log statement. Theos.hostname()
is always added in addition to any tags you specify. Default[]
.