【问题标题】:Winston logger profiler time unitWinston 记录器分析器时间单位
【发布时间】:2021-05-03 16:21:39
【问题描述】:

我正在使用 winston 记录器分析。

我的问题是如何更改分析器的时间单位。

我的代码:

this.logger.profile(`some ${jobId}`);
// do the job ....
this.logger.profile(`some ${jobId}`);

在我看到的结果中:

{ ...,"message": "some 1", "durationMs":2500 ... }

我的问题是如何(是否)可以将时间单位从 ms 配置为 seconds/minuets 等...

让我看看

{ ...,"message": "some 1", "durationSeconds: 2.5" ... }

【问题讨论】:

    标签: node.js winston


    【解决方案1】:

    很遗憾,答案是否定的:winston 没有提供以毫秒以外的单位提供持续时间的选项,请参阅:

    https://github.com/winstonjs/winston/blob/master/lib/winston/profiler.js#L47

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-08
      • 2019-06-12
      • 2022-07-14
      • 2023-03-29
      • 1970-01-01
      • 2019-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多