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 #163

Open
mountaindude opened this issue May 5, 2022 · 1 comment
Open

Make Winston logger handle errors properly #163

mountaindude opened this issue May 5, 2022 · 1 comment

Comments

@mountaindude
Copy link
Collaborator

The logging module of Butler CW 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
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
Projects
None yet
Development

No branches or pull requests

1 participant