close
The Wayback Machine - https://web.archive.org/web/20201205234930/https://github.com/uber-go/zap/pull/372
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

Export zap's internal observing logger #372

Merged
merged 2 commits into from Mar 14, 2017
Merged

Conversation

@billf
Copy link
Contributor

@billf billf commented Mar 13, 2017

Simplify internal/observer and export it as zaptest/observer.

)
infoLogger, _ := observer.New(InfoLevel)
warnLogger, _ := observer.New(WarnLevel)
tee := NewTee(infoLogger, warnLogger)

This comment has been minimized.

@prashantv

prashantv Mar 14, 2017
Contributor

do we need real loggers here, can we pass NopLoggers or something?

This comment has been minimized.

@akshayjshah

akshayjshah Mar 14, 2017
Contributor

The NopCore is always disabled, so it's not helpful here.

// error, but does so that it can be used as an observer sink function.
func (o *ObservedLogs) Add(log LoggedEntry) error {
// Add appends a new observed log to the collection.
func (o *ObservedLogs) Add(log LoggedEntry) {

This comment has been minimized.

@prashantv

prashantv Mar 14, 2017
Contributor

does this need to be exported?

This comment has been minimized.

@akshayjshah

akshayjshah Mar 14, 2017
Contributor

Nope, I'll push a small change to un-export it.

"go.uber.org/zap/zaptest/observer"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

This comment has been minimized.

@akshayjshah

akshayjshah Mar 14, 2017
Contributor

👍 Thanks for the import reordering.

)
infoLogger, _ := observer.New(InfoLevel)
warnLogger, _ := observer.New(WarnLevel)
tee := NewTee(infoLogger, warnLogger)

This comment has been minimized.

@akshayjshah

akshayjshah Mar 14, 2017
Contributor

The NopCore is always disabled, so it's not helpful here.

// error, but does so that it can be used as an observer sink function.
func (o *ObservedLogs) Add(log LoggedEntry) error {
// Add appends a new observed log to the collection.
func (o *ObservedLogs) Add(log LoggedEntry) {

This comment has been minimized.

@akshayjshah

akshayjshah Mar 14, 2017
Contributor

Nope, I'll push a small change to un-export it.

@akshayjshah akshayjshah force-pushed the billf:observer branch from c6e59b3 to 5b86d29 Mar 14, 2017
@akshayjshah akshayjshah changed the title Expose an observer suitable for use in tests Export zap Mar 14, 2017
@akshayjshah akshayjshah changed the title Export zap Export zap's internal observing logger Mar 14, 2017
@akshayjshah akshayjshah merged commit 79e323d into uber-go:master Mar 14, 2017
3 checks passed
3 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.03%) to 96.626%
Details
licence/cla Contributor License Agreement is signed.
Details
@billf billf deleted the billf:observer branch Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.