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

Add log.Logger's Output method to Logger&Entry #390

Closed
wants to merge 1 commit into from
Closed

Add log.Logger's Output method to Logger&Entry #390

wants to merge 1 commit into from

Conversation

droyo
Copy link

@droyo droyo commented Jul 30, 2016

The standard library's *log.Logger type has the method

Output(calldepth int, s string) error

Because it is so minimal, many libraries chose to target
it as an interface, which users could implement to receive
additional log messages:

type Logger {
    Output(int, string) error
}

While it is not overwhelmingly used, it is out there. Implementing
this interface allows us to use logrus.Logger and logrus.Entry
types to receive log messages from such libraries. I chose to log
such messages at the "Info" level, copying the Print* methods. The
"calldepth" argument is ignored.

Addresses issue #118

The standard library's *log.Logger type has the method

	Output(calldepth int, s string) error

Because it is so minimal, many libraries chose to target
it as an interface, which users could implement to receive
additional log messages:

	type Logger {
		Output(int, string) error
	}

While it is not overwhelmingly used, it is out there. Implementing
this interface allows us to use logrus.Logger and logrus.Entry
types to receive log messages from such libraries. I chose to log
such messages at the "Info" level, copying the Print* methods. The
"calldepth" argument is ignored.
@droyo droyo closed this Mar 11, 2017
@gravis
Copy link
Contributor

gravis commented Apr 5, 2017

Why was this issue closed?
It makes perfect sense to me

Thanks

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