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

Error StackTrace is not logged in a user friendly format #360

Closed
anamariadragomir opened this issue Feb 12, 2014 · 4 comments
Closed

Error StackTrace is not logged in a user friendly format #360

anamariadragomir opened this issue Feb 12, 2014 · 4 comments

Comments

@anamariadragomir
Copy link

Hello,

I would like to have the stacktrace printed on multiple lines , as it is done using console.log.
If I use json:false , the error is printed on a single line.
If I use json:false and prettyPrint :true, the error is printed as a JSON, contianing more information then I need like process, os, track, stack.

I would like to have only the stack printed in the case that I have an error.

Is there any way, as I could not find one.

I looked in the logger.js and changed :Logger.prototype._uncaughtException = function (err) {
var self = this,
responded = false,
info = exception.getAllInfo(err),
handlers = this._getExceptionHandlers(),
timeout,
doExit;

...
to info = exception.getAllInfo(err).stack , and it works, but I don't want to change the winston code in order to be able to have the stack nicely printed.

Thank you,

Ana

@robinduckett
Copy link

Why not parse the json yourself?

In my use case for winston, it is better that I get the whole json in my error logs as a single line so it can be processed properly.

For console output you can use JSON.stringify(err.stack, null, 2); to pretty print as json.

@anamariadragomir
Copy link
Author

Your solution is ok for caught errors , but not for UncaughtExceptions.

@JustinBeaudry
Copy link

If in your custom Console logger you're specifying handleExceptions remove that line and it will print out the standard node stack trace.

@indexzero
Copy link
Member

Duplicate of #84. It is important to us!

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

No branches or pull requests

4 participants