Reputation: 9
I am currently working on NodeJS application project.
This application basically performs:
Interaction with Database (1000 request/response processing per min)
Server side processing logic using information obtained from database
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:
File Name
Function Name
Line No
Process ID
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
Reputation: 474
If your question still actual, you can try this one
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