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

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

Make Winston logger handle errors properly #41

mountaindude opened this issue May 5, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@mountaindude
Copy link
Contributor

The logging module of qs-jwt 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 the enhancement New feature or request label May 5, 2022
@mountaindude
Copy link
Contributor 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
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant