go-tigertonic
go-tigertonic copied to clipboard
Customlogger
PR to make the (JSON)logging a little bit more versatile. This lets you log to stdout, files etc by supplying your own logger instead of having JSONLogged create one for you.
I often find myself wanting to log to both stdout and a persisted log file, using io.MultiWriter.
logWriter := io.MultiWriter(os.Stdout, myLogFileHandle)
multiLogger := log.New(logWriter, "prefix", 0)
tigertonic.JSONLogged(handler, redactor, multiLogger)
If this PR gets accepted I will create pull requests for tigertonic.Logged and tigertonic.ApacheLogged with the same changes.
Could we make the prefix and the logger configurable under the CustomJSONLogged constructor?