我在我的 express/nodejs Web 应用程序中配置了这样的日志记录。日志消息中的时间戳以 GMT 为单位。有没有办法获取当地时间?
var winston = require('winston');
winston.emitErrs = true;
var logger = new winston.Logger({
transports: [
new winston.transports.File({
level: 'debug',
filename: './logs/all-logs.log',
handleExceptions: true,
json: false,
maxsize: 5242880, //5MB
maxFiles: 5,
colorize: false,
timestamp:true
}),
new winston.transports.Console({
timestamp :true,
level: 'debug',
handleExceptions: true,
json: false,
colorize: true
})
],
exitOnError: false
});
module.exports = logger;
module.exports.stream = {
write: function(message, encoding){
logger.info(message);
}
};
这是我得到的示例日志
2014-11-18T18:30:33.570Z - debug: Authenticated