winston logger无法在nodejs

时间:2018-06-12 03:40:20

标签: javascript node.js logging winston

当记录器导出到新文件时,它不会创建日志, 我有两个文件

1] abc.js

let winston = require('winston');require('winston-logrotate');

var logger = new winston.Logger({
    level: 'info',
    transports: [
      new (winston.transports.File)({ filename: 'somefile.log' })
    ]
  });
module.exports = logger;

2] app.js

const logger = require('./abc');

logger.info("is it working"); // not change is made in the log file after this command
console.log(logger); // this is working 

0 个答案:

没有答案