Logging in nodejs using bunyan logger

后端 未结 3 1569
Happy的楠姐
Happy的楠姐 2021-01-15 12:39

I am initializing the bunyan logger in my nodejs code as below:

var log = bunyan.createLogger({
    name: \'myapp\',
    stream: process.stdout,
    level: \         


        
3条回答
  •  囚心锁ツ
    2021-01-15 13:27

    Try this ...

    var Logger = require('bunyan');
    var applogger = new Logger({
      name: 'helloapi',
      streams: [
        {
          level: 'info',
          path: './log/applogging.log'
        }
      ]
    });
    

    check their home page for further instructions https://github.com/trentm/node-bunyan#streams-introduction

    Hope this has helped. :)

提交回复
热议问题