How is the winston logger accessible?



  • The documentation is doing a great job at describing how to configure winston for logging but I can't seem to find information on how to access the logger instance, especially in scripts. I see req.logger and req.reporter.logger in some repo code but this won't work. I tried adding the logger to the global scope, but the global variable is not exposed in scripts. Please enlighten me, also adding this information to the docs would be greatly helpful.


  • administrators

    hi! why you want to get access the logger instance? if you do normal console.log, console.warn, console.error in scripts you will get the messages in the final logs. maybe this is not clear in docs and we need to add this in scripts docs.

    the only reason to access the internal logger instance is when you work with jsreport extensions but i think it is not the case here.


  • administrators

    FYI i've added a new section in script docs that tries to explain this a little more. thanks



  • Awesome! Thanks!


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.