Documentation ¶
Index ¶
- func DPanicw(msg string, keysAndValues ...interface{})
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func NewLogfmtEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func Panic(args ...interface{})
- func Panicf(template string, args ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func Printf(template string, args ...interface{})
- func Println(args ...interface{})
- func SetOptions(opt Options)
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- type Level
- type Logger
- func (l Logger) DPanicw(msg string, keysAndValues ...interface{})
- func (l Logger) Debug(args ...interface{})
- func (l Logger) Debugf(template string, args ...interface{})
- func (l Logger) Debugw(msg string, keysAndValues ...interface{})
- func (l Logger) Error(args ...interface{})
- func (l Logger) Errorf(template string, args ...interface{})
- func (l Logger) Errorw(msg string, keysAndValues ...interface{})
- func (l Logger) Fatal(args ...interface{})
- func (l Logger) Fatalf(template string, args ...interface{})
- func (l Logger) Fatalw(msg string, keysAndValues ...interface{})
- func (l Logger) Info(args ...interface{})
- func (l Logger) Infof(template string, args ...interface{})
- func (l Logger) Infow(msg string, keysAndValues ...interface{})
- func (l Logger) Panic(args ...interface{})
- func (l Logger) Panicf(template string, args ...interface{})
- func (l Logger) Panicw(msg string, keysAndValues ...interface{})
- func (l Logger) Printf(template string, args ...interface{})
- func (l Logger) Println(args ...interface{})
- func (l Logger) Warn(args ...interface{})
- func (l Logger) Warnf(template string, args ...interface{})
- func (l Logger) Warnw(msg string, keysAndValues ...interface{})
- func (l Logger) With(args ...interface{}) Logger
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DPanicw ¶ added in v0.2.0
func DPanicw(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 Debugf ¶
func Debugf(template string, args ...interface{})
Debugf uses fmt.Sprintf to log a templated message.
func Debugw ¶ added in v0.2.0
func Debugw(msg string, keysAndValues ...interface{})
Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
func Errorw ¶ added in v0.2.0
func Errorw(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 Fatal ¶
func Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
func Fatalw ¶ added in v0.2.0
func Fatalw(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 Infof ¶
func Infof(template string, args ...interface{})
Infof uses fmt.Sprintf to log a templated message.
func Infow ¶ added in v0.2.0
func Infow(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 NewLogfmtEncoder ¶ added in v0.2.0
func NewLogfmtEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
func Panic ¶
func Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message, then panics.
func Panicf ¶
func Panicf(template string, args ...interface{})
Panicf uses fmt.Sprintf to log a templated message, then panics.
func Panicw ¶ added in v0.2.0
func Panicw(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.
Types ¶
type Level ¶
type Level int8
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel Level = iota - 1 // InfoLevel is the default logging priority. InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel // DPanicLevel logs are particularly important errors. In development the // logger panics after writing the message. DPanicLevel // PanicLevel logs a message, then panics. PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel )
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger represents the global SugaredLogger
func StandardLogger ¶
func StandardLogger() Logger
StandardLogger returns the standard logger with stdout output.
func With ¶
func With(args ...interface{}) Logger
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.
func (Logger) DPanicw ¶ added in v0.2.0
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 (Logger) Debug ¶
func (l Logger) Debug(args ...interface{})
Debug uses fmt.Sprint to construct and log a message.
func (Logger) Debugw ¶ added in v0.2.0
Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func (Logger) Error ¶
func (l Logger) Error(args ...interface{})
Error uses fmt.Sprint to construct and log a message.
func (Logger) Errorw ¶ added in v0.2.0
Errorw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func (Logger) Fatal ¶
func (l Logger) Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func (Logger) Fatalw ¶ added in v0.2.0
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 (Logger) Info ¶
func (l Logger) Info(args ...interface{})
Info uses fmt.Sprint to construct and log a message.
func (Logger) Infow ¶ added in v0.2.0
Infow logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func (Logger) Panic ¶
func (l Logger) Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message, then panics.
func (Logger) Panicw ¶ added in v0.2.0
Panicw logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With.
func (Logger) Warn ¶
func (l Logger) Warn(args ...interface{})
Warn uses fmt.Sprint to construct and log a message.
func (Logger) Warnw ¶ added in v0.2.0
Warnw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
type Options ¶
type Options struct { // Stdout sets the writer as stdout if it is true. Stdout bool `yaml:"stdout"` // logger ouput format, Valid values are "json", "console" and "logfmt", default is logfmt Format string `yaml:"format"` // Filename is the file to write logs to. Backup log files will be retained // in the same directory. Filename string `yaml:"filename"` // MaxSize is the maximum size in megabytes of the log file before it gets rotated. MaxSize int `yaml:"max_size"` // MaxAge is the maximum number of days to retain old log files based on the // timestamp encoded in their filename. Note that a day is defined as 24 // hours and may not exactly correspond to calendar days due to daylight // savings, leap seconds, etc. The default is not to remove old log files // based on age. MaxAge int `yaml:"max_age"` // MaxBackups is the maximum number of old log files to retain. The default // is to retain all old log files (though MaxAge may still cause them to get // deleted.) MaxBackups int `yaml:"max_backups"` // Level is a logging priority. Higher levels are more important. Level string `yaml:"level"` }
Options is the option set for Logger.