const loggin = require('loggin-js');
const csol = loggin
.notifier('console', { name: 'csol' })
.color(false)
.level('debug')
.formatter('detailed');
const file = loggin
.notifier('file')
.formatter('detailed')
.pipe(loggin.severity('debug'), './debug.log');
const logger =
loggin.logger({
notifiers: [csol, file]
}).channel('logger1');
logger.info('info');
logger.color(false);
// You can modify the notifier any time
logger.error('some <%rerror>');
logger.critical('critical');
console.log('--------------------------------------------------');
let logger2 = logger.clone({
formatter: 'long',
channel: 'logger2',
color: false
});
logger2.debug('debug', { id: '0000' });
logger2.info('info');
logger2.error('some <%rerror>');
logger2.critical('critical');
// Deactivate one notifier
logger2.getNotifier('csol').enabled(false);
logger2.critical('not logged to console');
logger2.critical('critical');
logger2.silly('critical', null, {
formatter: 'short'
});