node.js express custom format debug logging -
a seemingly simple question, unsure of node.js equivalent i'm used (say python, or lamp), , think there may not one.
problem statement: want use basic, simple logging in express app. maybe want output debug messages, or info messages, or stats log consumption other back-end systems later.
1) want logs message, however, contain fields: remote-ip , request url, example.
2) on other hand, code logs everywhere in app, including deep inside call tree.
3) don't want pass (req,res)
down every node in call tree (this creates lot of parameter passing not needed, , complicates code, need pass these async callbacks , timeouts etc.)
in other systems, there thread per request, store (req,res) pair (where data need is) in thread-local-storage, , logger read , format message.
in node, there 1 thread. alternative here? what's "the request context in specific piece of code running under"?
the way can think of achieving looking @ trace, , using reflection @ local variables call tree. hate that, plus need implement callbacks, settimeouts, setintervals, new function()'s, eval's, ... , list goes on.
what other people doing?
Comments
Post a Comment