(t *testing.T)
| 516 | } |
| 517 | |
| 518 | func TestLoggerDPanic(t *testing.T) { |
| 519 | withLogger(t, DebugLevel, nil, func(logger *Logger, logs *observer.ObservedLogs) { |
| 520 | assert.NotPanics(t, func() { logger.DPanic("") }) |
| 521 | assert.Equal( |
| 522 | t, |
| 523 | []observer.LoggedEntry{{Entry: zapcore.Entry{Level: DPanicLevel}, Context: []Field{}}}, |
| 524 | logs.AllUntimed(), |
| 525 | "Unexpected log output from DPanic in production mode.", |
| 526 | ) |
| 527 | }) |
| 528 | withLogger(t, DebugLevel, opts(Development()), func(logger *Logger, logs *observer.ObservedLogs) { |
| 529 | assert.Panics(t, func() { logger.DPanic("") }) |
| 530 | assert.Equal( |
| 531 | t, |
| 532 | []observer.LoggedEntry{{Entry: zapcore.Entry{Level: DPanicLevel}, Context: []Field{}}}, |
| 533 | logs.AllUntimed(), |
| 534 | "Unexpected log output from DPanic in development mode.", |
| 535 | ) |
| 536 | }) |
| 537 | } |
| 538 | |
| 539 | func TestLoggerNoOpsDisabledLevels(t *testing.T) { |
| 540 | withLogger(t, WarnLevel, nil, func(logger *Logger, logs *observer.ObservedLogs) { |
nothing calls this directly
no test coverage detected