【问题标题】:winston-daily-rotate-file prepend option not workingwinston-daily-rotate-file prepend 选项不起作用
【发布时间】:2016-06-30 09:57:36
【问题描述】:

我的 winston 设置如下

// Config import.
var config = require('../config');

// Library imports.
var winston = require('winston');

var logger = new(winston.Logger)({
    transports: [
        new(winston.transports.Console)({
            level: 'debug',
            colorize: true,
            timestamp: true,
            json: true,
            showLevel: true
        }),
        new(require('winston-daily-rotate-file'))({
            prepend: true,
            level: 'debug',
            colorize: true,
            timestamp: true,
            filename: 'log.txt',
            maxSize: config.log.maxSize,
            json: true,
            prettyPrint: true 
        })
    ]
});

它可以正常登录到控制台 - 正如预期的那样。 它按预期记录到文件中。

但是,文件名的日期被添加到文件名的末尾,而不是开头,就像 prepend 选项所建议的那样。

有没有人能对此提供任何见解?

【问题讨论】:

    标签: node.js logging winston


    【解决方案1】:

    解决了这个问题 - 我有点傻。

    项目 github 页面上master 中显示的版本与npm install 提供的版本不同 - 通过 npm 提供的版本目前不支持 prepend 选项。

    希望很快就会发布 :)

    【讨论】:

      猜你喜欢
      • 2019-10-21
      • 2019-06-12
      • 2017-01-31
      • 1970-01-01
      • 2020-09-28
      • 2022-01-20
      • 1970-01-01
      • 1970-01-01
      • 2014-06-13
      相关资源
      最近更新 更多