Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Zap lager #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Zap lager #22

wants to merge 2 commits into from

Conversation

MHBauer
Copy link
Collaborator

@MHBauer MHBauer commented Aug 22, 2018

I was bored, but we can't use the adapter from cf/routing because zap has changed.

@cfdreddbot
Copy link

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?"
Copy link
Collaborator Author

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,
}
}
Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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?"
}

Copy link
Collaborator Author

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"
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants