mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
18 lines
588 B
JavaScript
18 lines
588 B
JavaScript
// remember to change the require to just 'log4js' if you've npm install'ed it
|
|
const log4js = require('../lib/log4js');
|
|
|
|
log4js.configure({
|
|
appenders: { cheese: { type: 'file', filename: 'cheese.log' } },
|
|
categories: { default: { appenders: ['cheese'], level: 'error' } },
|
|
});
|
|
|
|
const logger = log4js.getLogger('cheese');
|
|
logger.level = 'ERROR';
|
|
|
|
logger.trace('Entering cheese testing');
|
|
logger.debug('Got cheese.');
|
|
logger.info('Cheese is Gouda.');
|
|
logger.warn('Cheese is quite smelly.');
|
|
logger.error('Cheese is too ripe!');
|
|
logger.fatal('Cheese was breeding ground for listeria.');
|