首页 > 解决方案 > Morgan dev pretermined Format Broken

问题描述

So I am logging the logs using Morgan, The problem is that when I use the "dev" predefined mode, the logs seem broken they look something like this

[0mGET / [36m304[0m 45.776 ms - -[0m

[0mGET / [36m304[0m 15.317 ms - -[0m

However it should look something like this

GET / 304 0m 0m 15.317 ms -0

It seems to me that it is working fine but as dev mode have colours defined in it, and those colours are printing these weird symbols that my Linux(PopOS) Machine is unable to recognize,

my questions are how to fix it so that colour remains. Or just disable colours in dev mode to fix it

app.use(morgan(
          mode: 'dev',
          options: {
            stream: accessLogStreamDevelopment,
          }
        ));


标签: node.jslinuxexpressloggingmorgan

解决方案


推荐阅读