Express.js 调试信息缺少计时

Express.js debugging info missing timing

我在 docker 容器中有一个应用程序 运行,使用 express.js 4.17.1.

我正在尝试调试一些性能问题并使用 DEBUG=express:* env 设置启用了快速调试,这正在工作并给我如下输出:

Fri, 20 May 2022 13:24:09 GMT express:router use '/sitemap.txt' router
Fri, 20 May 2022 13:24:09 GMT express:router:layer new '/sitemap.txt'
Fri, 20 May 2022 13:24:09 GMT express:router use '/health' <anonymous>
...
Fri, 20 May 2022 13:24:09 GMT express:router use '/' <anonymous>
Fri, 20 May 2022 13:24:09 GMT express:router:layer new '/'
Fri, 20 May 2022 13:24:09 GMT express:application set "port" to 3000
...
Fri, 20 May 2022 13:25:17 GMT express:router dispatching GET /
Fri, 20 May 2022 13:25:17 GMT express:router query  : /
Fri, 20 May 2022 13:25:17 GMT express:router expressInit  : /
Fri, 20 May 2022 13:25:17 GMT express:router <anonymous>  : /
Fri, 20 May 2022 13:25:17 GMT express:router corsMiddleware  : /
...
Fri, 20 May 2022 13:25:17 GMT express:router router  : /
Fri, 20 May 2022 13:25:17 GMT express:router dispatching GET /
Fri, 20 May 2022 13:25:19 GMT express:view require "pug"
Fri, 20 May 2022 13:25:19 GMT express:view lookup "user/views/index.pug"
Fri, 20 May 2022 13:25:19 GMT express:view stat "/usr/app/pug/user/views/index.pug"
Fri, 20 May 2022 13:25:19 GMT express:view render "/usr/app/pug/user/views/index.pug"

然而,在所有示例中,输出都包含关键时序信息:

  express:router:route new / +0ms
  express:router:layer new / +1ms
  express:router:route get / +1ms
  express:router:layer new / +0ms
  express:router:route new / +1ms
  express:router:layer new / +0ms
  express:router:route get / +0ms
  express:router:layer new / +0ms
  express:application compile etag weak +1ms

如何在调试输出中启用此计时信息?

这似乎与 debug 模块在 TTY 与 non-TTY 环境中的不同行为有关。

在 Docker 容器中,默认情况下禁用颜色,因此似乎省略了时间信息。

尝试 运行 带有额外环境变量的容器 DEBUG_COLORS=1