MCPcopy
hub / github.com/grpc/grpc-go / TestLoggerV2PrintFuncAllDiscard

Function TestLoggerV2PrintFuncAllDiscard

grpclog/internal/loggerv2_test.go:191–208  ·  view source on GitHub ↗

TestLoggerV2PrintFuncAllDiscard tests that discard loggers don't log.

(t *testing.T)

Source from the content-addressed store, hash-verified

189
190// TestLoggerV2PrintFuncAllDiscard tests that discard loggers don't log.
191func TestLoggerV2PrintFuncAllDiscard(t *testing.T) {
192 logger := NewLoggerV2(io.Discard, io.Discard, io.Discard, LoggerV2Config{})
193 loggerTp := logger.(*loggerT)
194
195 sprintf = makeSprintfErr(t)
196 sprint = makeSprintErr(t)
197 sprintln = makeSprintErr(t)
198
199 // test that printFunc doesn't call the log func on discard loggers
200 // makeLogFuncErr will fail the test if it's called
201 loggerTp.output(infoLog, logFuncStr)
202 loggerTp.output(warningLog, logFuncStr)
203 loggerTp.output(errorLog, logFuncStr)
204
205 sprintf = fmt.Sprintf
206 sprint = fmt.Sprint
207 sprintln = fmt.Sprintln
208}
209
210func TestLoggerV2PrintFuncAllCombinations(t *testing.T) {
211 const (

Callers

nothing calls this directly

Calls 4

makeSprintfErrFunction · 0.85
makeSprintErrFunction · 0.85
outputMethod · 0.80
NewLoggerV2Function · 0.70

Tested by

no test coverage detected