Skip to content

Customlogger#67

Open
JimmyPettersson85 wants to merge 4 commits intorcrowley:masterfrom
JimmyPettersson85:customlogger
Open

Customlogger#67
JimmyPettersson85 wants to merge 4 commits intorcrowley:masterfrom
JimmyPettersson85:customlogger

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