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

Function TestLoggerV2

zapgrpc/internal/test/grpc_test.go:35–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33)
34
35func TestLoggerV2(t *testing.T) {
36 core, observedLogs := observer.New(zapcore.InfoLevel)
37 zlog := zap.New(core)
38
39 grpclog.SetLoggerV2(zapgrpc.NewLogger(zlog))
40
41 grpclog.Info("hello from grpc")
42
43 logs := observedLogs.TakeAll()
44 require.Len(t, logs, 1, "Expected one log entry.")
45 entry := logs[0]
46
47 assert.Equal(t, zapcore.InfoLevel, entry.Level,
48 "Log entry level did not match.")
49 assert.Equal(t, "hello from grpc", entry.Message,
50 "Log entry message did not match.")
51}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
NewFunction · 0.92
NewLoggerFunction · 0.92
TakeAllMethod · 0.80
InfoMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected