Allow logging to be overridden
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
@rcrowley Any thoughts on this?
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: https://github.com/golang/go/commit/1a1d43239e42184694d0207ffad9bbb77d8e8f76