MCPcopy
hub / github.com/uber-go/zap / TestLoggerSyncFail

Function TestLoggerSyncFail

logger_test.go:614–625  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

612}
613
614func TestLoggerSyncFail(t *testing.T) {
615 noSync := &ztest.Buffer{}
616 err := errors.New("fail")
617 noSync.SetError(err)
618 logger := New(zapcore.NewCore(
619 zapcore.NewJSONEncoder(zapcore.EncoderConfig{}),
620 noSync,
621 DebugLevel,
622 ))
623 assert.Equal(t, err, logger.Sync(), "Expected Logger.Sync to propagate errors.")
624 assert.Equal(t, err, logger.Sugar().Sync(), "Expected SugaredLogger.Sync to propagate errors.")
625}
626
627func TestLoggerAddCaller(t *testing.T) {
628 tests := []struct {

Callers

nothing calls this directly

Calls 6

NewCoreFunction · 0.92
NewJSONEncoderFunction · 0.92
SetErrorMethod · 0.80
SugarMethod · 0.80
NewFunction · 0.70
SyncMethod · 0.65

Tested by

no test coverage detected