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

Make Winston logger handle errors properly #404

Closed
mountaindude opened this issue May 5, 2022 · 1 comment · Fixed by #427
Closed

Make Winston logger handle errors properly #404

mountaindude opened this issue May 5, 2022 · 1 comment · Fixed by #427

Comments

@mountaindude
Copy link
Collaborator

The logging module of Butler SOS does not currently handle error logging as well as it should.
Specifically, in some cases there is no stack trace or error message when errors occur.

This can be easily fixed by adding the following to the Winston.createLogger call:

winston.format.errors({ stack: true })

@mountaindude mountaindude added this to the 9.0 milestone May 5, 2022
@mountaindude
Copy link
Collaborator Author

Example

logTransports.push(
    new winston.transports.Console({
        name: 'console',
        level: config.get('Butler.logLevel'),
        format: winston.format.combine(
            winston.format.errors({ stack: true }),
            winston.format.timestamp(),
            winston.format.colorize(),
            winston.format.simple(),
            winston.format.printf((info) => `${info.timestamp} ${info.level}: ${info.message}`)
        ),
    })
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment