Closed melalj closed 7 years ago
It sounds like your problem is more with the stack trace than express-winston's output. Am I understanding your issue correctly?
As you found, there is currently no way to customize the logged output of errors (other than the msg
, which is pretty trivial). I personally haven't found much need for that scenario, but I'm open to ideas/PRs.
It was more to quickly see on the console what is the error message instead of middlewareError
, I found a workaround by setting: msg: '{{err.message}}'
for errorLogger
Ah, excellent! Glad you found something that does what you need. Should this issue be closed then, or is there something outstanding?
Since there's a way to show the error message instead of middlewareError
, we can say that this ticket is solved ;)
Maybe someone would stumble upon this issue and customise the output. (Maybe you should improve the readme to state that err
can be used for msg in errorLogger in addition of req and res)
Thanks btw for developing this tool :)
No problem! I updated the readme to include err
as an example in the error logger's msg
option (https://github.com/bithavoc/express-winston/commit/d488e28)
Where there's an error within express, it outputs by default
middlewareError
as error message with a massive stacktrace.It's pretty hard to spot right away what's wrong. I tried to customize the output with the option in errorLogger:
msg: "{{stack[0]}}
but it doesn't seems to do anything.