-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to render \n
s in arbitrary data properties
#426
Comments
|
@jsumners I don't think that's the case. This is currently not possible in pino-pretty. I'm not even sure how it could be implemented reliably, but it would be good PR there. |
The implementation here recognizes serialized errors from Pino. |
Yes, exactly. This is not a serialized error. |
Yep you've got it @mcollina, I should have been clearer. For that first second screencap I'm doing @mcollina if it's implemented for the error serializer, surely it's possible? Would it just be a case of extracting the code in this error serializer that renders newlines, and making it available as a config option? |
The code is very specific for errors: https://github.com/pinojs/pino-pretty/blob/master/lib/utils.js#L180. A PR would be awesome. |
OK I'll have a crack when I find some time! Still a bit unsure why the https://github.com/pinojs/pino-pretty/blob/master/lib/utils.js#L152 |
@egargan Hi, did you find the solution? |
I would also find this useful. I am an project where we use a custom serializer for errors and the stack trace is serialized as a property |
I'd like to be able to display just the
stack
property when logging errors, instead of giving the whole error to Pino when logging them.In an app of mine, I like to log out only an error's
stack
property, instead of just giving the entire error to Pino to display. When I do this, thestack
is printed in a signle line, without rendering its\n
s.If I hand the whole error to Pino, i.e.
logger.error(err)
, the stack is printed "prettily", broken across multiple lines.How do I tell Pino to render my
stack
property's newlines? I've looked through the docs for pino-pretty's config options, but I can't find anything there that solves my problem.The text was updated successfully, but these errors were encountered: