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

Customlogger #67

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

JimmyPettersson85
Copy link

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.

@rcrowley
Copy link
Owner

Could we make the prefix and the logger configurable under the CustomJSONLogged constructor?

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