-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/log: Improve API for testing (#916)
internal/log: Improve API for testing I just noticed that d9472a0 caused the profiler package to always emit some log output, regardless of `go test -v` being used or not. I'm very sorry about this. IMO tests should never print to stdout unless requested. This patch is my attempt to fix this by making it easy for individual tests to capture the log output (see UseLogger, RecordLogger). I've also added DiscardLogger since it can be very convenient for tests that want to ignore log output without capturing it. Arguably RecordLogger could be used for this as well, but that would do a poor job of capturing the intend of such code.
- Loading branch information
Showing
2 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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