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

Function TestLoggerV2PrintFuncNoDiscard

grpclog/internal/loggerv2_test.go:164–188  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

162}
163
164func TestLoggerV2PrintFuncNoDiscard(t *testing.T) {
165 buffers := []*bytes.Buffer{new(bytes.Buffer), new(bytes.Buffer), new(bytes.Buffer)}
166 logger := NewLoggerV2(buffers[infoLog], buffers[warningLog], buffers[errorLog], LoggerV2Config{})
167 loggerTp := logger.(*loggerT)
168
169 loggerTp.output(errorLog, logFuncStr)
170
171 infoB, err := buffers[infoLog].ReadBytes('\n')
172 if err != nil {
173 t.Fatalf("level %v: %v", infoLog, err)
174 }
175 checkLogContainsFuncStr(t, infoB)
176
177 warnB, err := buffers[warningLog].ReadBytes('\n')
178 if err != nil {
179 t.Fatalf("level %v: %v", warningLog, err)
180 }
181 checkLogContainsFuncStr(t, warnB)
182
183 errB, err := buffers[errorLog].ReadBytes('\n')
184 if err != nil {
185 t.Fatalf("level %v: %v", errorLog, err)
186 }
187 checkLogContainsFuncStr(t, errB)
188}
189
190// TestLoggerV2PrintFuncAllDiscard tests that discard loggers don't log.
191func TestLoggerV2PrintFuncAllDiscard(t *testing.T) {

Callers

nothing calls this directly

Calls 4

checkLogContainsFuncStrFunction · 0.85
outputMethod · 0.80
NewLoggerV2Function · 0.70
FatalfMethod · 0.65

Tested by

no test coverage detected