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

Method Sugar

logger.go:146–150  ·  view source on GitHub ↗

Sugar wraps the Logger to provide a more ergonomic, but slightly slower, API. Sugaring a Logger is quite inexpensive, so it's reasonable for a single application to use both Loggers and SugaredLoggers, converting between them on the boundaries of performance-sensitive code.

()

Source from the content-addressed store, hash-verified

144// single application to use both Loggers and SugaredLoggers, converting
145// between them on the boundaries of performance-sensitive code.
146func (log *Logger) Sugar() *SugaredLogger {
147 core := log.clone()
148 core.callerSkip += 2
149 return &SugaredLogger{core}
150}
151
152// Named adds a new path segment to the logger's name. Segments are joined by
153// periods. By default, Loggers are unnamed.

Callers 15

global.goFile · 0.80
ReplaceGlobalsFunction · 0.80
withSugarFunction · 0.80
TestSugarWithCapturesFunction · 0.80
TestSugaredLoggerLevelFunction · 0.80
TestLoggerSyncFunction · 0.80
TestLoggerSyncFailFunction · 0.80
TestLoggerAddCallerFunction · 0.80
Example_presetsFunction · 0.80
NewLoggerFunction · 0.80

Calls 1

cloneMethod · 0.95

Tested by 15

withSugarFunction · 0.64
TestSugarWithCapturesFunction · 0.64
TestSugaredLoggerLevelFunction · 0.64
TestLoggerSyncFunction · 0.64
TestLoggerSyncFailFunction · 0.64
TestLoggerAddCallerFunction · 0.64
Example_presetsFunction · 0.64