Node.js Logging

前端 未结 9 1835
一个人的身影
一个人的身影 2021-01-29 17:28

Is there any library which will help me to handle logging in my Node.Js application? All I want to do is, I want to write all logs into a File and also I need an options like ro

9条回答
  •  礼貌的吻别
    2021-01-29 17:49

    A 'nodejslogger' module can be used for simple logging. It has three levels of logging (INFO, ERROR, DEBUG)

    var logger = require('nodejslogger')
    logger.init({"file":"output-file", "mode":"DIE"})
    

    D : Debug, I : Info, E : Error

    logger.debug("Debug logs")
    logger.info("Info logs")
    logger.error("Error logs")
    

    The module can be accessed at : https://www.npmjs.com/package/nodejslogger

提交回复
热议问题