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

Function NewLoggerV2

grpclog/internal/loggerv2.go:249–267  ·  view source on GitHub ↗

NewLoggerV2 creates a new LoggerV2 instance with the provided configuration. The infoW, warningW, and errorW writers are used to write log messages of different severity levels.

(infoW, warningW, errorW io.Writer, c LoggerV2Config)

Source from the content-addressed store, hash-verified

247// The infoW, warningW, and errorW writers are used to write log messages of
248// different severity levels.
249func NewLoggerV2(infoW, warningW, errorW io.Writer, c LoggerV2Config) LoggerV2 {
250 flag := log.LstdFlags
251 if c.FormatJSON {
252 flag = 0
253 }
254
255 warningW = combineLoggers(infoW, warningW)
256 errorW = combineLoggers(errorW, warningW)
257
258 fatalW := errorW
259
260 m := []*log.Logger{
261 log.New(infoW, "", flag),
262 log.New(warningW, "", flag),
263 log.New(errorW, "", flag),
264 log.New(fatalW, "", flag),
265 }
266 return &loggerT{m: m, v: c.Verbosity, jsonFormat: c.FormatJSON}
267}

Callers 9

NewLoggerV2Function · 0.92
NewLoggerV2WithVerbosityFunction · 0.92
newLoggerV2Function · 0.92
TestLoggerV2SeverityFunction · 0.70
TestLoggerV2FatalFunction · 0.70

Calls 1

combineLoggersFunction · 0.85