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.
()
| 144 | // single application to use both Loggers and SugaredLoggers, converting |
| 145 | // between them on the boundaries of performance-sensitive code. |
| 146 | func (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. |