MCPcopy
hub / github.com/keploy/keploy / newConsoleLogger

Function newConsoleLogger

utils/log/logger_test.go:18–29  ·  view source on GitHub ↗

newConsoleLogger builds a logger whose only sink is the provided writer, at the provided level. Used as the input to AddDebugFileSink in tests so we can inspect both branches independently.

(w zapcore.WriteSyncer, level zapcore.Level)

Source from the content-addressed store, hash-verified

16// at the provided level. Used as the input to AddDebugFileSink in tests
17// so we can inspect both branches independently.
18func newConsoleLogger(w zapcore.WriteSyncer, level zapcore.Level) *zap.Logger {
19 cfg := zap.NewDevelopmentConfig()
20 LogCfg = cfg
21 LogCfg.EncoderConfig.EncodeTime = customTimeEncoder
22 LogCfg.EncoderConfig.EncodeLevel = zapcore.CapitalLevelEncoder
23 LogCfg.EncoderConfig.EncodeDuration = zapcore.StringDurationEncoder
24 LogCfg.EncoderConfig.EncodeCaller = nil
25 LogCfg.Level = zap.NewAtomicLevelAt(level)
26 encoder := zapcore.NewConsoleEncoder(LogCfg.EncoderConfig)
27 core := zapcore.NewCore(encoder, wrapWriter(w), LogCfg.Level)
28 return zap.New(newRedactingCore(core))
29}
30
31type syncBuffer struct {
32 mu bytes.Buffer

Calls 3

wrapWriterFunction · 0.85
newRedactingCoreFunction · 0.85
NewMethod · 0.65

Tested by

no test coverage detected