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

Function combineLoggers

grpclog/internal/loggerv2.go:236–244  ·  view source on GitHub ↗

combineLoggers returns a combined logger for both higher & lower severity logs, or only one if the other is io.Discard. This uses io.Discard instead of io.MultiWriter when all loggers are set to io.Discard. Both this package and the standard log package have significant optimizations for io.Discard

(lower, higher io.Writer)

Source from the content-addressed store, hash-verified

234// significant optimizations for io.Discard, which io.MultiWriter lacks (as of
235// this writing).
236func combineLoggers(lower, higher io.Writer) io.Writer {
237 if lower == io.Discard {
238 return higher
239 }
240 if higher == io.Discard {
241 return lower
242 }
243 return io.MultiWriter(lower, higher)
244}
245
246// NewLoggerV2 creates a new LoggerV2 instance with the provided configuration.
247// The infoW, warningW, and errorW writers are used to write log messages of

Callers 1

NewLoggerV2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected