fix: Include stacktrace into error message#118
fix: Include stacktrace into error message#118Ayzrian wants to merge 1 commit intowinstonjs:masterfrom
Conversation
|
@indexzero excuse me for bothering, but could you please review this and merge if everything is okay? (It is kinda pain that a lot of users encountered with |
|
Bump. I love everything else about Winston but not being able to see my error stack traces is pretty much a deal breaker ;( |
|
Thanks for the PR. The issue discussion pointed to a related issue in It would seem consistent with that post to accept improvements making an alternative formatter that provides stack trace information easier to use, but not to make a simple formatter that works well for some use cases more complex. |
|
Thank you for the detailed response with links. I really appreciate it. I will try out @medington's code. In general, I think the request of "make it super easy to log the stack trace, especially when you're developing / debugging" is a reasonable request of a logging package, and seems to have not been adequately addressed for years. my current hack is: which seems... pretty hacky |
|
I agree that seems hacky; I think there should be (whether or not there is today) some way to include a few lines in your construction of the winstonLogger that incorporates a formatter giving you that. |
The problem
Log format
errorsactually confuses users. When a user specifiesstack: truehe or she expects that the stack trace will be included into the message, but it does not. For instance, this issue is a great example of such confusion winstonjs/winston#1498Because we are not appending the message to the
info.messageandinfo[MESSAGE]some formatters may not show the actual stack trace, for example,simple.Solution
The easy way is to append the stack trace to the
info.messageandinfo[MESSAGE]ifstack: true, and leaveinfo.stack = stackfor backward compatibility with other code that was written so far