-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add WithPanicHook logger option for panic log tests (#1416)
Add a `WithPanicHook` logger option that allows callers to specify custom behavior besides panicking on Panic/DPanic logs. This is similar to what we already have with the WithFatal hook implemented in #861. This will make it possible to unit test Panic log cases like the one we had with our periodic runner which was impossible because of unrecoverable panics in another go routine. Added unit tests and they pass. ``` $ make test ? go.uber.org/zap/internal [no test files] ? go.uber.org/zap/internal/bufferpool [no test files] ok go.uber.org/zap (cached) ? go.uber.org/zap/internal/readme [no test files] ok go.uber.org/zap/buffer (cached) ok go.uber.org/zap/internal/color (cached) ok go.uber.org/zap/internal/exit (cached) ok go.uber.org/zap/internal/pool (cached) ok go.uber.org/zap/internal/stacktrace (cached) ok go.uber.org/zap/internal/ztest (cached) ok go.uber.org/zap/zapcore (cached) ok go.uber.org/zap/zapgrpc (cached) ok go.uber.org/zap/zapio (cached) ok go.uber.org/zap/zaptest (cached) ok go.uber.org/zap/zaptest/observer (cached) ok go.uber.org/zap/exp/zapfield (cached) ok go.uber.org/zap/exp/zapslog (cached) ok go.uber.org/zap/benchmarks (cached) [no tests to run] ok go.uber.org/zap/zapgrpc/internal/test (cached) ``` Closes #1415
- Loading branch information
1 parent
0e2aa4e
commit e5a56ee
Showing
3 changed files
with
160 additions
and
18 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
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