2015-12-15 93 views
1

我在我的节点应用程序中使用winston记录器,我想将自定义消息记录到日志文件中。使用winston只记录消息

var logger = new winston.Logger({ 
    transports: [ 
     new winston.transports.File({ 
      level: 'info', 
      filename: '/tmp/test.log', 
      handleExceptions: true, 
      json: true, 
      maxsize: 20971520 //20MB 
     }) 
    ], 
    exitOnError: false 
}); 

我只需要在日志中记录消息,我不需要在日志文件中记录日志级别和时间戳。当前记录的样本如下。

{"level":"info","message":"sample entry to log","timestamp":"2015-12-11T09:43:50.507Z"} 

我的目的是让在日志文件条目如下

sample entry to log 

如何实现这一目标?

回答