Documentation ¶
Index ¶
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func Panic(args ...interface{})
- func Panicf(template string, args ...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{})
- type Level
- type Logger
- func (l Logger) Debug(args ...interface{})
- func (l Logger) Debugf(template string, args ...interface{})
- func (l Logger) Error(args ...interface{})
- func (l Logger) Errorf(template string, args ...interface{})
- func (l Logger) Fatal(args ...interface{})
- func (l Logger) Fatalf(template string, args ...interface{})
- func (l Logger) Info(args ...interface{})
- func (l Logger) Infof(template string, args ...interface{})
- func (l Logger) Panic(args ...interface{})
- func (l Logger) Panicf(template string, args ...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) With(args ...interface{}) Logger
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf uses fmt.Sprintf to log a templated message.
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
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 Infof ¶
func Infof(template string, args ...interface{})
Infof uses fmt.Sprintf to log a templated message.
func Panic ¶
func Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message, then panics.
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) Debug ¶
func (l Logger) Debug(args ...interface{})
Debug uses fmt.Sprint to construct and log a message.
func (Logger) Error ¶
func (l Logger) Error(args ...interface{})
Error uses fmt.Sprint to construct and log a message.
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) Info ¶
func (l Logger) Info(args ...interface{})
Info uses fmt.Sprint to construct and log a message.
func (Logger) Panic ¶
func (l Logger) Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message, then panics.
func (Logger) Warn ¶
func (l Logger) Warn(args ...interface{})
Warn uses fmt.Sprint to construct and log a message.
type Options ¶
type Options struct { // Stdout sets the writer as stdout if it is true. Stdout bool // ConsoleMode sets logger to be the console mode which claims the logger encoder type as console. ConsoleMode bool // Filename is the file to write logs to. Backup log files will be retained // in the same directory. Filename string // MaxSize is the maximum size in megabytes of the log file before it gets rotated. MaxSize int // 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 // 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 // Level is a logging priority. Higher levels are more important. Level string }
Options is the option set for Logger.