Currently log interface requires an event name followed by optional context object, e.g.:
logger.trace('compile', {foo: 'bar'})
Idea is to allow an alternative signature where just the context is passed, e.g.:
logger.trace({foo: 'bar'})
In pretty mode could just have the event part dropped, e.g.:
With event:
– trace a.b.c:foo -- a: 1 b: 2
Without event:
– trace a.b.c -- a: 1 b: 2
The event field in anonymous events could be anonymous. Just dropping the key altogether would be better for bandwidth though––how much? Could be a production-time optimization...
Why
Sometimes you want to log something but don't have a strong concept for an event name. Might be especially true for trace level.
So, want the API to scale gracefully from temp/unsure/lightweight logging to more robust/long-term/production logs. Logging should be as fluid/easy as possible to start out. Forcing an event name feels to add too much burden.
What
Currently log interface requires an event name followed by optional context object, e.g.:
Idea is to allow an alternative signature where just the context is passed, e.g.:
In pretty mode could just have the event part dropped, e.g.:
With event:
Without event:
The
event
field in anonymous events could beanonymous
. Just dropping the key altogether would be better for bandwidth though––how much? Could be a production-time optimization...Why
trace
level.