Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Export zap's internal observing logger #372
Conversation
| ) | ||
| infoLogger, _ := observer.New(InfoLevel) | ||
| warnLogger, _ := observer.New(WarnLevel) | ||
| tee := NewTee(infoLogger, warnLogger) |
prashantv
Mar 14, 2017
Contributor
do we need real loggers here, can we pass NopLoggers or something?
do we need real loggers here, can we pass NopLoggers or something?
akshayjshah
Mar 14, 2017
Contributor
The NopCore is always disabled, so it's not helpful here.
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) { |
prashantv
Mar 14, 2017
Contributor
does this need to be exported?
does this need to be exported?
akshayjshah
Mar 14, 2017
Contributor
Nope, I'll push a small change to un-export it.
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" |
akshayjshah
Mar 14, 2017
Contributor
👍 Thanks for the import reordering.
| ) | ||
| infoLogger, _ := observer.New(InfoLevel) | ||
| warnLogger, _ := observer.New(WarnLevel) | ||
| tee := NewTee(infoLogger, warnLogger) |
akshayjshah
Mar 14, 2017
Contributor
The NopCore is always disabled, so it's not helpful here.
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) { |
akshayjshah
Mar 14, 2017
Contributor
Nope, I'll push a small change to un-export it.
Nope, I'll push a small change to un-export it.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Simplify
internal/observerand export it aszaptest/observer.