2012-06-29 07:38:23 +08:00
|
|
|
//remember to change the require to just 'log4js' if you've npm install'ed it
|
2012-06-29 07:37:41 +08:00
|
|
|
var log4js = require('./lib/log4js');
|
2012-06-29 07:38:23 +08:00
|
|
|
//by default the console appender is loaded
|
2012-06-29 07:37:41 +08:00
|
|
|
//log4js.loadAppender('console');
|
2012-06-29 07:38:23 +08:00
|
|
|
//you'd only need to add the console appender if you
|
|
|
|
//had previously called log4js.clearAppenders();
|
2012-06-29 07:37:41 +08:00
|
|
|
//log4js.addAppender(log4js.appenders.console());
|
2012-06-29 07:38:23 +08:00
|
|
|
log4js.loadAppender('file');
|
2012-06-29 07:37:41 +08:00
|
|
|
log4js.addAppender(log4js.appenders.file('cheese.log'), 'cheese');
|
|
|
|
|
|
|
|
var logger = log4js.getLogger('cheese');
|
|
|
|
logger.setLevel('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.');
|