How can I add timestamp to logs using Node.js library Winston?

后端 未结 9 740
清歌不尽
清歌不尽 2021-01-31 12:55

I want to add timestamp to logs. What is the best way to achieve this?

9条回答
  •  Happy的楠姐
    2021-01-31 13:45

    we could use console-stamp to add timestamp and log level to the existing console: require('console-stamp')(console, '[yyyy-mm-dd HH:MM:ss.l]')

    See https://github.com/starak/node-console-stamp for the details

提交回复
热议问题