-
Notifications
You must be signed in to change notification settings - Fork 940
Open
Description
When using pino in the browser multiple child log bindings are just printed one after the other rather than coalesced into a single object: e.g.
logger.child({ foo: 'foo'}).child({ bar: 'bar'}).info("Hello, %s!", "World");Prints:
{ foo: 'foo'} { bar: 'bar' } Hello, World!
Which is kinda weird, as in node you just get a single object.
Ideas
I think what would be helpful here are a few new features:
- The ability for
writeto receive the merged and serialized bindings but the message and args unformatted so they can be passed as is to the underlyingconsolemethods, keeping their special handling in the Browser devtools. Like a variation ofasObjector an additional flag on top of it. – Add asObjectBindingsOnly, allowing write to receive only the bindings as object #2051 - The ability to get the original log method in write, so you can still forward to the correct console method, while manipulating the way the message with args is written. Which can be used with the above to custom format a log message before being passed to the console method.
[ ] Alternatively, an option to get a callback that will get the merged bindings object and args, which will be used to build the arguments for write instead ofasObject? Like a different variation of a formatter, that receives the args thatwritewould receive if we do 1 instead, where we won't need to add a way to get the original console method in write or have the user do that to customize formatting in this case.- The ability to make pino filter the console messages using the logger level and not only transmit.
- The ability to get the formatted object in
transmit.send, when you want to send it upstream to a logging system rather than echoing it to a server side pino instead.
@mcollina What do you think?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels