首页 > 解决方案 > 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.jswinston

解决方案


不幸的是,答案是否定的:winston 没有提供以 ms 以外的单位提供持续时间的选项,请参阅:

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


推荐阅读