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

Add generic middleware logger interface #254

Merged
merged 1 commit into from
Aug 28, 2017

Conversation

beornf
Copy link
Contributor

@beornf beornf commented Aug 28, 2017

As I prefer to use a custom logger making the logger an interface means I can inject my own for request logging.

This also has the property of being fully backwards compatible with the stdlib logger.

@pkieltyka
Copy link
Member

please show example usage

@beornf
Copy link
Contributor Author

beornf commented Aug 28, 2017

Overriding the default logger as below works:

middleware.DefaultLogger = middleware.RequestLogger(&middleware.DefaultLogFormatter{
    Logger: logrus.New(),
}

@pkieltyka pkieltyka merged commit 5ccae9b into go-chi:master Aug 28, 2017
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

Successfully merging this pull request may close these issues.

2 participants