Support logrus.Field logger in the logrus adapter#793
Merged
ChrisHines merged 1 commit intogo-kit:masterfrom Nov 13, 2018
sagikazarmark:logrus_fieldlogger
Merged
Support logrus.Field logger in the logrus adapter#793ChrisHines merged 1 commit intogo-kit:masterfrom sagikazarmark:logrus_fieldlogger
ChrisHines merged 1 commit intogo-kit:masterfrom
sagikazarmark:logrus_fieldlogger
Conversation
ChrisHines
requested changes
Nov 13, 2018
log/logrus/logrus_logger.go
Outdated
|
|
||
| // NewLogrusLogger returns a go-kit log.Logger that sends log events to a Logrus logger. | ||
| func NewLogrusLogger(logger *logrus.Logger) log.Logger { | ||
| // NewLogrusLogger returns a go-kit log.FieldLogger that sends log events to a Logrus logger. |
Member
There was a problem hiding this comment.
The function still returns a go-kit log.Logger. It's the input type that has changed to accept the logrus.FieldLogger type.
The phrase "... to a Logrus logger" still seems accurate and perhaps more to the point. Ending with "... to a logrus.FieldLogger" would be more precise, but just repeating what the code says. I'm not a Logrus user, so I'm not sure which phrasing is more intuitive for that user base. Thoughts?
Suggested change
| // NewLogrusLogger returns a go-kit log.FieldLogger that sends log events to a Logrus logger. | |
| // NewLogrusLogger returns a go-kit log.Logger that sends log events to a Logrus logger. |
Contributor
Author
There was a problem hiding this comment.
Ah, good catch, it was kinda automatic change. 🙂
ChrisHines
approved these changes
Nov 13, 2018
Member
ChrisHines
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
Contributor
Author
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Logrus exposes an interface
FieldLogger. It is usually better to hint against this interface, because the main logger instance returns a different type for loggers preannotated with structured context (namely*Entry). This way one can do this: