kocolosk commented on issue #1373: Structured logging
URL: https://github.com/apache/couchdb/issues/1373#issuecomment-394924878
 
 
   Some comments after musing on this topic for a day:
   
   - We'll need an interface that keeps the current lazy evaluation behavior so 
that we're not sitting around generating debug messages that won't get sent. 
The current printf style is efficient in this respect.
   - The reason I'm worried about the above is that a future JSON formatter 
won't be happy receiving aribtrary Erlang terms, so I was trying to figure out 
the right place to transform them. Doing it at the point of the logging 
invocation runs the risk of wasted effort if the log level is set higher.
   - We exhumed `lager` from the codebase a few years ago. Why? Was it simply 
that we thought it was a lot of unnecessary code?
   - Erlang 21 adds a new logger inspired by lager: 
http://erlang.org/documentation/doc-10.0-rc1/lib/kernel-6.0/doc/html/logger_chapter.html.
 The new Erlang logger does allow for maps and/or key-value lists to be logged 
directly.
   - The legacy error_logger also has the concept of a `report` which is a list 
of atoms and 2-tuples. A `report` is not necessarily JSON-compatible because 
each value is an arbitrary term.
   
   Lazy evaluation could be as simple as wrapping every log invocation in a 
`fun() -> ... end` and only invoking the function once we've checked the log 
level. That should be efficient and cheap, but probably means reverting to 
macros instead of direct M:F/A calls ...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to