Adding timestamps to all console messages

前端 未结 12 1093
鱼传尺愫
鱼传尺愫 2021-01-31 06:51

I have a complete, deployed, Express-based project, with many console.log() and console.error() statements throughout. The project runs using forever, directing the st

12条回答
  •  鱼传尺愫
    2021-01-31 07:13

    module: "log-timestamp" works for me.

    see https://www.npmjs.com/package/log-timestamp

    npm install log-timestamp
    

    Simple to use

    console.log('Before log-timestamp');
    require('log-timestamp');
    console.log('After log-timestamp');
    

    Result

    Before log-timestamp
    [2012-08-23T20:08:32.000Z] After log-timestamp
    

提交回复
热议问题