Closed dhruvbird closed 12 years ago
Why is this needed? I mean the present logging is sufficient for us to know where (function name and line number) it was logged based on the content of the log by doing a simple look up in the code.
I can buy that. I mean it does work, but it seems that line logging would be easier and would make the logs less prone to error. Currently, we try to make each line unique, which kinda sucks... What do you think?
I'll try to come up with a quick prototype of a library that I think does most of what I think node-xmpp-bosh needs - let me know if you agree/disagree.
https://github.com/dhruvbird/node-lumberjack It's much slower than log4js (which is what is used currently) because it tries to deduce info. such as the object, function names and the line number from which the message was printed.
On a synthetic benchmark, printing 10^5 lines of log with a single %s argument took 15 sec in node-lumberjack v/s 2.5 sec in log4js. If the object, function names and line number are turned off the performance is the same.
You can track these changes in the branch node-lumberjack-logger (starts from commit 03aac9ddc3199e271f3aa7515f6e4e648fbcce05)
We need more information and configurability in logging. For example display the current function name, constructor, and line number while logging.