MCPcopy Index your code
hub / github.com/kopia/kopia / PrintfLevel

Function PrintfLevel

internal/testlogging/printf.go:19–29  ·  view source on GitHub ↗

PrintfLevel returns a logger that uses given printf-style function to print log output for logs of a given level or above.

(printf func(msg string, args ...any), prefix string, level zapcore.Level)

Source from the content-addressed store, hash-verified

17
18// PrintfLevel returns a logger that uses given printf-style function to print log output for logs of a given level or above.
19func PrintfLevel(printf func(msg string, args ...any), prefix string, level zapcore.Level) *zap.SugaredLogger {
20 writer := printfWriter{printf, prefix}
21
22 return zap.New(
23 zapcore.NewCore(
24 zaplogutil.NewStdConsoleEncoder(zaplogutil.StdConsoleEncoderConfig{}),
25 writer,
26 level,
27 ),
28 ).Sugar()
29}
30
31// PrintfFactory returns LoggerForModuleFunc that uses given printf-style function to print log output.
32func PrintfFactory(printf func(msg string, args ...any)) logging.LoggerFactory {

Callers 5

PrintfFunction · 0.85
ContextWithLevelFunction · 0.85

Calls 1

NewStdConsoleEncoderFunction · 0.92

Tested by

no test coverage detected