MCPcopy
hub / github.com/uber-go/zap / newZapLogger

Function newZapLogger

benchmarks/zap_test.go:106–116  ·  view source on GitHub ↗
(lvl zapcore.Level)

Source from the content-addressed store, hash-verified

104}
105
106func newZapLogger(lvl zapcore.Level) *zap.Logger {
107 ec := zap.NewProductionEncoderConfig()
108 ec.EncodeDuration = zapcore.NanosDurationEncoder
109 ec.EncodeTime = zapcore.EpochNanosTimeEncoder
110 enc := zapcore.NewJSONEncoder(ec)
111 return zap.New(zapcore.NewCore(
112 enc,
113 &ztest.Discarder{},
114 lvl,
115 ))
116}
117
118func newSampledLogger(lvl zapcore.Level) *zap.Logger {
119 return zap.New(zapcore.NewSamplerWithOptions(

Callers 7

BenchmarkWithoutFieldsFunction · 0.85
BenchmarkAddingFieldsFunction · 0.85
newSampledLoggerFunction · 0.85

Calls 4

NewJSONEncoderFunction · 0.92
NewFunction · 0.92
NewCoreFunction · 0.92

Tested by

no test coverage detected