pino-pretty
pino-pretty copied to clipboard
How to avoid new lines when using pretty print ?
My code:
pino( prettyPrint: { crlf : true, colorize: true});
Issue:
I am trying to avoid new lines when using prettyPrint, my output is like the below one,
[ed Jul 17 2019 16:14:53 GMT-0700 (Pacific Daylight Time)] DEBUG: The Correlation ID inside the Service Call One is correlationId: "offlineContext_requestId_1993731475678433" label: "Service Call One"
I do not understand the question. The point of pretty printing is to format the ndjson into a human readable form. If you don’t care for the format this module generates, try another one like pino-colada
.
I'm having this issue too. The problem is that if you pass in a merge object the properties get dropped onto a new line by default. I suspect the way to work around this is with a message format, but I can't seem to find any documentation of what the default format string is (the one that puts the time in brackets, and the pid in parentheses, etc). If I could find that, I suspect I could copy it and tweak it to do what I want with the properties on the merge object?
So I think the initial report was missing the actual logging invocation...
log.info({foo:"bar"},"message-n-stuff")
results in
[2023-10-17 18:06:12.345 -0400] INFO (45678) : message-n-stuff
foo: "bar"
https://github.com/pinojs/pino-pretty/blob/41fdd31b66506f862ad4ce3ca8a791408522bf8d/Readme.md?plain=1#L100-L101
Ok but I'm trying to make the program emit human readable logs at runtime... I've seen that you have a format mechanism with {} and {if } but I'm not seeing anything that approaches what I'm used to in the java world: https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout
After reading some other tickets it sounds like the date/level/process ("metadata") is hard coded and there's no such thing as a "default format specifier"? is that a correct understanding?
I see an "ignore" option, so perhaps if I ignore everything and then supply a format, and then declare/write pretifiers maybe that's the way to get full control of the line?
Edit: I found the runtime version of these... so this is now drifting off topic. Probably ought to be moved to discussions (except it looks like you haven't enabled that).