You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
578 B
20 lines
578 B
var log4js = require('log4js');
|
|
|
|
log4js.configure({
|
|
appenders: { cheese: { type: 'file', filename: 'cheese.log' } },
|
|
categories: { default: { appenders: ['cheese'], level: 'error' } }
|
|
});
|
|
|
|
exports.logger = function (level) {
|
|
var logger = log4js.getLogger("cheese");
|
|
logger.level = 'debug';
|
|
return logger;
|
|
};
|
|
|
|
// 配合 express 使用的方法
|
|
// exports.use = function (app, level) {
|
|
// app.use(log4js.connectLogger(log4js.getLogger('logInfo'), {
|
|
// level: levels[level] || levels['debug'],
|
|
// format: ':method :url :status'
|
|
// }));
|
|
// };
|