Add option to panic in test.NewNullLogger to allow testing of

calls to `Fatal*`

See #813
This commit is contained in:
Albert Salim
2018-10-06 18:08:19 +08:00
parent 1ed61965b9
commit 2be620216a
5 changed files with 35 additions and 7 deletions
+3 -3
View File
@@ -198,7 +198,7 @@ func (entry *Entry) Fatal(args ...interface{}) {
if entry.Logger.IsLevelEnabled(FatalLevel) {
entry.log(FatalLevel, fmt.Sprint(args...))
}
Exit(1)
entry.Logger.Exit(1)
}
func (entry *Entry) Panic(args ...interface{}) {
@@ -246,7 +246,7 @@ func (entry *Entry) Fatalf(format string, args ...interface{}) {
if entry.Logger.IsLevelEnabled(FatalLevel) {
entry.Fatal(fmt.Sprintf(format, args...))
}
Exit(1)
entry.Logger.Exit(1)
}
func (entry *Entry) Panicf(format string, args ...interface{}) {
@@ -293,7 +293,7 @@ func (entry *Entry) Fatalln(args ...interface{}) {
if entry.Logger.IsLevelEnabled(FatalLevel) {
entry.Fatal(entry.sprintlnn(args...))
}
Exit(1)
entry.Logger.Exit(1)
}
func (entry *Entry) Panicln(args ...interface{}) {