Skip to content

log.Logger should be a interface instead of a struct #14205

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

Closed
owenthereal opened this issue Feb 3, 2016 · 4 comments
Closed

log.Logger should be a interface instead of a struct #14205

owenthereal opened this issue Feb 3, 2016 · 4 comments
Labels
FrozenDueToAge v2 An incompatible library change

Comments

@owenthereal
Copy link

What version of Go are you using (go version)?

1.5.3.

What operating system and processor architecture are you using?

Linux. AMD 64.

What did you do?

We've been using logrus for structural logging which is good for querying and stuff. And we would like httputil.ReverseProxy.ErrorLog to log in the same format as logrus which is used in the application code. Since log.Logger is a struct instead of a interface, there's no way to adapt logrus to log.Logger.

What did you expect to see?

I would expect log.Logger to be a interface which defines a bunch of methods, e,g. Fatal(v ...interface{}) and allow different implementations. This way, even the Go standard library can log in same way as application code.

What did you see instead?

Well, log.Logger is a struct and the log format is different from our application code. We need to have other ways to query the log for stdlib.

@bradfitz
Copy link
Contributor

bradfitz commented Feb 3, 2016

Sorry, https://golang.org/doc/go1compat precludes any changes, regardless of anybody's opinion on the API design.

@bradfitz bradfitz closed this as completed Feb 3, 2016
@owenthereal
Copy link
Author

Alright...Go 2 please come...

@danp
Copy link
Contributor

danp commented Feb 3, 2016

Can or should this be left open with a Go2 label, similar to #14106 and others?

@bradfitz bradfitz added the v2 An incompatible library change label Feb 3, 2016
@bradfitz
Copy link
Contributor

bradfitz commented Feb 3, 2016

Sure. I'm going to leave it closed, though. If Go2 ever actually happens, we know how to find this back.

@golang golang locked and limited conversation to collaborators Feb 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge v2 An incompatible library change
Projects
None yet
Development

No branches or pull requests

4 participants