vmk
vmk

Reputation: 9

Nodejs logging module - production env

I am currently working on NodeJS application project.

This application basically performs:

  1. Interaction with Database (1000 request/response processing per min)

  2. Server side processing logic using information obtained from database

  3. Client request handling (100 request for every 5 mins)

For any project, logging information is key to identify any failures/processing state.

I tried winston nodejs log framework, but it happened that it does not support the following information:

  1. File Name

  2. Function Name

  3. Line No

  4. Process ID

  5. Host name etc

Hence I decided to go for bunyan logging framework. I understand Bunyan framework supports these things.

Please share your thoughts whether this can be used for production code.

If not possible, I fear how other nodejs projects used in many web application gets these information.

I could not get any production ready log framework in nodejs which supports these functionalities. I googled for information and search results leads to winston/bunyan.

Upvotes: 0

Views: 262

Answers (1)

Kandrat
Kandrat

Reputation: 474

If your question still actual, you can try this one

@grdon/logger

Usage example

const logger = require('@grdon/logger')({
 defaultLogDirectory : __dirname + "/logs",
})
// ...

logger([process.argv], 'logfile.txt')

Result will be

Start:Wed Sep 22 2021 13:52:22 GMT+0400 
 
[
  [
   'C:\\Program Files\\nodejs\\node.exe',
   'D:\\todel3\\test.js',
   [length]: 2
  ],
 [length]: 1
]
Trace:Object- File D:\grdon-test\test.js:6
Finish

filename, line, function names supported, and many other options

Upvotes: -1

Related Questions