Skip to content
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

pino-colada swallows errors #21

Closed
toddself opened this issue Jul 26, 2017 · 4 comments · Fixed by #46
Closed

pino-colada swallows errors #21

toddself opened this issue Jul 26, 2017 · 4 comments · Fixed by #46

Comments

@toddself
Copy link

If you log with log.fatal(err, 'something went wrong') you only see `something went wrong' in your log. It would be better if you got your stacktrace so you can see where the error occurred. (It does seem to log objects given post the error message, just not pre)

@lrlna
Copy link
Owner

lrlna commented Aug 4, 2017

@toddself so I get this with log.fatal, is there something else you would like to see? Or am I misunderstanding you?

screen shot 2017-08-04 at 15 14 53

@lrlna
Copy link
Owner

lrlna commented Oct 5, 2017

@toddself i've been thinking a bit more about getting to display this. When you do send over a .fatal() log with an error that is a type error, we print off the trace, i.e. like the one i have a screenshot above. The trace will go underneath the message you send over.

Pino basically flattens out the object you send over in the log. So if I were to log.info({ cute: 'floof'}, 'Here is an info log'), it would have a log like this.

{
 "pid":18802,
 "hostname":"Irinas-MacBook-Pro.local",
 "name":"merry",
 "level":30,
 "time":1507229693877,
 "msg":"It login",
 "parent":"merry:ctx",
 "cute":"floof",
 "v":1
}

I think what we can do as the first thing is displaying the stack trace when we just log error objects, kind of the way it's requested in #17. The other thing I've been thinking of is possibly be able to work with log.debug() and require the user to have a specific object we print off? i.e. log.debug({ debug: myObj }, 'debugging this statement') and then i can format/display the object under the specific debug` key.

The other thing I was thinking about is formatting the error messages a bit more. There are a few types of errors we work with, the ones that throw definitely need to have the entire trace. but if you're just working with a syntax error, you just need to know the file name, the line number and the type of error (SyntaxError, TypeError, etc). Or something with connection errors could look something like this: only first line when a connection was refused.

screen shot 2017-10-05 at 15 03 02

LMK what you think!

@vislamov
Copy link

@lrlna any thoughts on this? having the same issue

@TheTechmage
Copy link
Contributor

I just wanted to put this out there that, while not well-documented, pino-colada will dump an error if there is an "err" key in the pino logs. So if you log your errors like so, then pino-colada will show the error. For example:
Logging an error:

logger.fatal({err: err}, 'Uncaught Exception thrown');

Output from Pino-colada:
image

I can see about adding some documentation about this behavior to the readme and send in a PR

TheTechmage added a commit to TheTechmage/pino-colada that referenced this issue Dec 12, 2021
I noticed that, albeit old, issue lrlna#21 talks about pino-colada swallowing
errors. This simply isn't true in the latest releases of pino-colada.
Therefore, I have added some documentation to the readme that explains
the format and where each of the displayed items is coming from within
the log messages. This closes lrlna#21

Signed-off-by: Colton Wolkins (Indicio work address) <[email protected]>
@lrlna lrlna closed this as completed in #46 Dec 13, 2021
lrlna pushed a commit that referenced this issue Dec 13, 2021
I noticed that, albeit old, issue #21 talks about pino-colada swallowing
errors. This simply isn't true in the latest releases of pino-colada.
Therefore, I have added some documentation to the readme that explains
the format and where each of the displayed items is coming from within
the log messages. This closes #21

Signed-off-by: Colton Wolkins (Indicio work address) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants