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

Function NewStdLog

global.go:78–82  ·  view source on GitHub ↗

NewStdLog returns a *log.Logger which writes to the supplied zap Logger at InfoLevel. To redirect the standard library's package-global logging functions, use RedirectStdLog instead.

(l *Logger)

Source from the content-addressed store, hash-verified

76// InfoLevel. To redirect the standard library's package-global logging
77// functions, use RedirectStdLog instead.
78func NewStdLog(l *Logger) *log.Logger {
79 logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth))
80 f := logger.Info
81 return log.New(&loggerWriter{f}, "" /* prefix */, 0 /* flags */)
82}
83
84// NewStdLogAt returns *log.Logger which writes to supplied zap logger at
85// required level.

Callers 2

ExampleNewStdLogFunction · 0.92
TestNewStdLogFunction · 0.85

Calls 2

AddCallerSkipFunction · 0.85
WithOptionsMethod · 0.45

Tested by 2

ExampleNewStdLogFunction · 0.74
TestNewStdLogFunction · 0.68