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

Allow logging to be overridden #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robstrong
Copy link

I agree with #2 and #3 that logging should not forced upon users of this library. But I also agree with @rcrowley that the logging is useful and needed. This PR doesn't change the default logging functionality but adds a Logger var on the package that can be set to override where log messages go.

This can be useful for applications that already have a logger setup and want the goagain logs to go to the same place. You just set

myLogger := log.New(myWriter, "err: ", log.LstdFlags)
goagain.Logger = myLogger

Or if you wanted to disable logging altogether, you can set

goagain.Logger = nil

@robstrong
Copy link
Author

@rcrowley Any thoughts on this?

@brasic
Copy link

brasic commented Oct 13, 2015

Would love it if this could be merged. The current approach makes things difficult for applications that use specially formatted logs parsed by tools like logstash.

This is similar to a hardcoded logger that was changed to be configurable in the standard library's httputil/reverseproxy: golang/go@1a1d432

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.

3 participants