You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've just started using winston recently and so far quite like the way it works. The biggest problem for me right now is that I can't use splat in conjunction with errors in a way that makes sense. The below snippet showcases the issue I face
try{newError("something weng wrong")}catch(error){log.error("OOps",error);// ==> logs an error stack trace as expectedlog.error("Oops %d",1,error);//==> drops the error altogether and doesn't log it}
I have tried quite a few variations of formatter configurations and the formatter never (regradless of using splat or not) gets the error and stacktrace in a way that is usable in the printf formatter, or to add into json.
I have now hacked something that does the trick for me by intercepting the log and putting the stack into it's own object if an error is encountered (at the last position). This works then with the above logger setup using splat and json/printf formats
🔎 Search Terms
splat, stack trace, error
The problem
I've just started using winston recently and so far quite like the way it works. The biggest problem for me right now is that I can't use splat in conjunction with errors in a way that makes sense. The below snippet showcases the issue I face
I have tried quite a few variations of formatter configurations and the formatter never (regradless of using splat or not) gets the error and stacktrace in a way that is usable in the printf formatter, or to add into json.
For reference, the logger setup looks as follows
I have now hacked something that does the trick for me by intercepting the log and putting the stack into it's own object if an error is encountered (at the last position). This works then with the above logger setup using splat and json/printf formats
What version of Winston presents the issue?
v3.17.0
What version of Node are you using?
v20.17.0
If this worked in a previous version of Winston, which was it?
No response
Minimum Working Example
Additional information
No response
The text was updated successfully, but these errors were encountered: