-
Notifications
You must be signed in to change notification settings - Fork 3
Zap lager #22
base: master
Are you sure you want to change the base?
Zap lager #22
Conversation
Hey MHBauer! Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA. |
|
||
// SessionName returns the name of the logger session | ||
func (l *LagerAdapter) SessionName() string { | ||
return "why would you want the name of the logger?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't understand why this is a thing that exists.
return &LagerAdapter{ | ||
originalLogger: tmpLogger, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this is implemented correctly, and I mostly don't care.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Session is more useful in tracing and knowing where the logs are coming from in bigger projects where a lot of component logs come through or when you have many requests and you correlate all the logs for one request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saying that, lager does a special thing with session so you can track it all the way down to where the original logger was created. With the adapter we won't have that so can't use Session in that way anymore.
func (l *LagerAdapter) SessionName() string { | ||
return "why would you want the name of the logger?" | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything below is a direct copy.
"fmt" | ||
|
||
"code.cloudfoundry.org/lager" | ||
"go.uber.org/zap" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import changed.
// LagerAdapter satisfies the lager.Logger interface with zap as the | ||
// implementation. | ||
type LagerAdapter struct { | ||
originalLogger *zap.Logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is all pointers now.
I was bored, but we can't use the adapter from cf/routing because zap has changed.