const _oddNumberErrMsg … const _nonStringKeyErrMsg … const _multipleErrMsg … type SugaredLogger … // Desugar unwraps a SugaredLogger, exposing the original Logger. Desugaring // 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. func (s *SugaredLogger) Desugar() *Logger { … } // Named adds a sub-scope to the logger's name. See Logger.Named for details. func (s *SugaredLogger) Named(name string) *SugaredLogger { … } // WithOptions clones the current SugaredLogger, applies the supplied Options, // and returns the result. It's safe to use concurrently. func (s *SugaredLogger) WithOptions(opts ...Option) *SugaredLogger { … } // With adds a variadic number of fields to the logging context. It accepts a // mix of strongly-typed Field objects and loosely-typed key-value pairs. When // processing pairs, the first element of the pair is used as the field key // and the second as the field value. // // For example, // // sugaredLogger.With( // "hello", "world", // "failure", errors.New("oh no"), // Stack(), // "count", 42, // "user", User{Name: "alice"}, // ) // // is the equivalent of // // unsugared.With( // String("hello", "world"), // String("failure", "oh no"), // Stack(), // Int("count", 42), // Object("user", User{Name: "alice"}), // ) // // Note that the keys in key-value pairs should be strings. In development, // passing a non-string key panics. In production, the logger is more // forgiving: a separate error is logged, but the key-value pair is skipped // and execution continues. Passing an orphaned key triggers similar behavior: // panics in development and errors in production. func (s *SugaredLogger) With(args ...interface{ … } // WithLazy adds a variadic number of fields to the logging context lazily. // The fields are evaluated only if the logger is further chained with [With] // or is written to with any of the log level methods. // Until that occurs, the logger may retain references to objects inside the fields, // and logging will reflect the state of an object at the time of logging, // not the time of WithLazy(). // // Similar to [With], fields added to the child don't affect the parent, // and vice versa. Also, the keys in key-value pairs should be strings. In development, // passing a non-string key panics, while in production it logs an error and skips the pair. // Passing an orphaned key has the same behavior. func (s *SugaredLogger) WithLazy(args ...interface{ … } // Level reports the minimum enabled level for this logger. // // For NopLoggers, this is [zapcore.InvalidLevel]. func (s *SugaredLogger) Level() zapcore.Level { … } // Log logs the provided arguments at provided level. // Spaces are added between arguments when neither is a string. func (s *SugaredLogger) Log(lvl zapcore.Level, args ...interface{ … } // Debug logs the provided arguments at [DebugLevel]. // Spaces are added between arguments when neither is a string. func (s *SugaredLogger) Debug(args ...interface{ … } // Info logs the provided arguments at [InfoLevel]. // Spaces are added between arguments when neither is a string. func (s *SugaredLogger) Info(args ...interface{ … } // Warn logs the provided arguments at [WarnLevel]. // Spaces are added between arguments when neither is a string. func (s *SugaredLogger) Warn(args ...interface{ … } // Error logs the provided arguments at [ErrorLevel]. // Spaces are added between arguments when neither is a string. func (s *SugaredLogger) Error(args ...interface{ … } // DPanic logs the provided arguments at [DPanicLevel]. // In development, the logger then panics. (See [DPanicLevel] for details.) // Spaces are added between arguments when neither is a string. func (s *SugaredLogger) DPanic(args ...interface{ … } // Panic constructs a message with the provided arguments and panics. // Spaces are added between arguments when neither is a string. func (s *SugaredLogger) Panic(args ...interface{ … } // Fatal constructs a message with the provided arguments and calls os.Exit. // Spaces are added between arguments when neither is a string. func (s *SugaredLogger) Fatal(args ...interface{ … } // Logf formats the message according to the format specifier // and logs it at provided level. func (s *SugaredLogger) Logf(lvl zapcore.Level, template string, args ...interface{ … } // Debugf formats the message according to the format specifier // and logs it at [DebugLevel]. func (s *SugaredLogger) Debugf(template string, args ...interface{ … } // Infof formats the message according to the format specifier // and logs it at [InfoLevel]. func (s *SugaredLogger) Infof(template string, args ...interface{ … } // Warnf formats the message according to the format specifier // and logs it at [WarnLevel]. func (s *SugaredLogger) Warnf(template string, args ...interface{ … } // Errorf formats the message according to the format specifier // and logs it at [ErrorLevel]. func (s *SugaredLogger) Errorf(template string, args ...interface{ … } // DPanicf formats the message according to the format specifier // and logs it at [DPanicLevel]. // In development, the logger then panics. (See [DPanicLevel] for details.) func (s *SugaredLogger) DPanicf(template string, args ...interface{ … } // Panicf formats the message according to the format specifier // and panics. func (s *SugaredLogger) Panicf(template string, args ...interface{ … } // Fatalf formats the message according to the format specifier // and calls os.Exit. func (s *SugaredLogger) Fatalf(template string, args ...interface{ … } // Logw logs a message with some additional context. The variadic key-value // pairs are treated as they are in With. func (s *SugaredLogger) Logw(lvl zapcore.Level, msg string, keysAndValues ...interface{ … } // Debugw logs a message with some additional context. The variadic key-value // pairs are treated as they are in With. // // When debug-level logging is disabled, this is much faster than // // s.With(keysAndValues).Debug(msg) func (s *SugaredLogger) Debugw(msg string, keysAndValues ...interface{ … } // Infow logs a message with some additional context. The variadic key-value // pairs are treated as they are in With. func (s *SugaredLogger) Infow(msg string, keysAndValues ...interface{ … } // Warnw logs a message with some additional context. The variadic key-value // pairs are treated as they are in With. func (s *SugaredLogger) Warnw(msg string, keysAndValues ...interface{ … } // Errorw logs a message with some additional context. The variadic key-value // pairs are treated as they are in With. func (s *SugaredLogger) Errorw(msg string, keysAndValues ...interface{ … } // DPanicw logs a message with some additional context. In development, the // logger then panics. (See DPanicLevel for details.) The variadic key-value // pairs are treated as they are in With. func (s *SugaredLogger) DPanicw(msg string, keysAndValues ...interface{ … } // Panicw logs a message with some additional context, then panics. The // variadic key-value pairs are treated as they are in With. func (s *SugaredLogger) Panicw(msg string, keysAndValues ...interface{ … } // Fatalw logs a message with some additional context, then calls os.Exit. The // variadic key-value pairs are treated as they are in With. func (s *SugaredLogger) Fatalw(msg string, keysAndValues ...interface{ … } // Logln logs a message at provided level. // Spaces are always added between arguments. func (s *SugaredLogger) Logln(lvl zapcore.Level, args ...interface{ … } // Debugln logs a message at [DebugLevel]. // Spaces are always added between arguments. func (s *SugaredLogger) Debugln(args ...interface{ … } // Infoln logs a message at [InfoLevel]. // Spaces are always added between arguments. func (s *SugaredLogger) Infoln(args ...interface{ … } // Warnln logs a message at [WarnLevel]. // Spaces are always added between arguments. func (s *SugaredLogger) Warnln(args ...interface{ … } // Errorln logs a message at [ErrorLevel]. // Spaces are always added between arguments. func (s *SugaredLogger) Errorln(args ...interface{ … } // DPanicln logs a message at [DPanicLevel]. // In development, the logger then panics. (See [DPanicLevel] for details.) // Spaces are always added between arguments. func (s *SugaredLogger) DPanicln(args ...interface{ … } // Panicln logs a message at [PanicLevel] and panics. // Spaces are always added between arguments. func (s *SugaredLogger) Panicln(args ...interface{ … } // Fatalln logs a message at [FatalLevel] and calls os.Exit. // Spaces are always added between arguments. func (s *SugaredLogger) Fatalln(args ...interface{ … } // Sync flushes any buffered log entries. func (s *SugaredLogger) Sync() error { … } // log message with Sprint, Sprintf, or neither. func (s *SugaredLogger) log(lvl zapcore.Level, template string, fmtArgs []interface{ … } // logln message with Sprintln func (s *SugaredLogger) logln(lvl zapcore.Level, fmtArgs []interface{ … } // getMessage format with Sprint, Sprintf, or neither. func getMessage(template string, fmtArgs []interface{ … } // getMessageln format with Sprintln. func getMessageln(fmtArgs []interface{ … } func (s *SugaredLogger) sweetenFields(args []interface{ … } type invalidPair … func (p invalidPair) MarshalLogObject(enc zapcore.ObjectEncoder) error { … } type invalidPairs … func (ps invalidPairs) MarshalLogArray(enc zapcore.ArrayEncoder) error { … }