Documentation ¶
Index ¶
- func Error(a ...interface{})
- func Errorf(format string, a ...interface{})
- func Errorln(a ...interface{})
- func Fatal(a ...interface{})
- func Fatalf(format string, a ...interface{})
- func Fatalln(a ...interface{})
- func Info(a ...interface{})
- func Infof(format string, a ...interface{})
- func Infoln(a ...interface{})
- func SetDefaultLogger(l Logger)
- func Warning(a ...interface{})
- func Warningf(format string, a ...interface{})
- func Warningln(a ...interface{})
- type Level
- type Logger
- type Severity
- type SilentLogger
- func (l *SilentLogger) Clone(wrapper int) Logger
- func (*SilentLogger) Error(...interface{})
- func (*SilentLogger) Errorf(string, ...interface{})
- func (*SilentLogger) Errorln(...interface{})
- func (*SilentLogger) Fatal(v ...interface{})
- func (*SilentLogger) Fatalf(string, ...interface{})
- func (*SilentLogger) Fatalln(v ...interface{})
- func (*SilentLogger) Info(...interface{})
- func (*SilentLogger) Infof(string, ...interface{})
- func (*SilentLogger) Infoln(...interface{})
- func (l *SilentLogger) V(Level) Verboser
- func (*SilentLogger) Warning(...interface{})
- func (*SilentLogger) Warningf(string, ...interface{})
- func (*SilentLogger) Warningln(...interface{})
- type Verboser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(a ...interface{})
Error logs to the ERROR logs. Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func Errorf ¶
func Errorf(format string, a ...interface{})
Errorf logs to the ERROR logs. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Errorln ¶
func Errorln(a ...interface{})
Errorln logs to the ERROR logs. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
func Fatal ¶
func Fatal(a ...interface{})
Fatal logs to the FATAL logs, then calls os.Exit(1). Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func Fatalf ¶
func Fatalf(format string, a ...interface{})
Fatalf logs to the FATAL logs, then calls os.Exit(1). Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Fatalln ¶
func Fatalln(a ...interface{})
Fatalln logs to the FATAL logs, then calls os.Exit(1). Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
func Info ¶
func Info(a ...interface{})
Info logs to the INFO log. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
func Infof ¶
func Infof(format string, a ...interface{})
Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func Infoln ¶
func Infoln(a ...interface{})
Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
func Warning ¶
func Warning(a ...interface{})
Warning logs to the WARNING logs. Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
Types ¶
type Level ¶
type Level int32
Level is log level of verboser. We strongly recommend you to follow the rules: 0 - logs that must be visible to users, e.g. programmer errors, panic context, cli argument, etc 1 - logs that is useful to users, e.g. config (listening on X, watching Y), important error info, etc 2 - logs about system behavior, e.g. system state change, request info, etc 3 - logs that is nice to have, e.g. scheduler decision, monitoring info, etc 4 - debug level verbosity N - not recommended to use but up to developers
const ( // LevelDebug is for debug info. LevelDebug Level = 4 )
type Logger ¶
type Logger interface { Verboser // V reports whether verbosity at the call site is at least the requested level. // The returned value is a Verboser, which implements Info, Infof // and Infoln. These methods will write to the Info log if called. V(Level) Verboser // Warning logs to the WARNING logs. // Arguments are handled in the manner of fmt.Print; a newline is appended if missing. Warning(...interface{}) // Warningf logs to the WARNING logs. // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. Warningf(string, ...interface{}) // Warningln logs to the WARNING logs. // Arguments are handled in the manner of fmt.Println; a newline is appended if missing. Warningln(...interface{}) // Error logs to the ERROR logs. // Arguments are handled in the manner of fmt.Print; a newline is appended if missing. Error(...interface{}) // Errorf logs to the ERROR logs. // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. Errorf(string, ...interface{}) // Errorln logs to the ERROR logs. // Arguments are handled in the manner of fmt.Println; a newline is appended if missing. Errorln(...interface{}) // Fatal logs to the FATAL logs, then calls os.Exit(1). // Arguments are handled in the manner of fmt.Print; a newline is appended if missing. Fatal(...interface{}) // Fatalf logs to the FATAL logs, then calls os.Exit(1). // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. Fatalf(string, ...interface{}) // Fatalln logs to the FATAL logs, then calls os.Exit(1). // Arguments are handled in the manner of fmt.Println; a newline is appended if missing. Fatalln(...interface{}) // Clone clones current logger with new wrapper. // A positive wrapper indicates how many wrappers outside the logger. // A negative wrapper indicates how many wrappers should be stripped. Clone(wrapper int) Logger }
Logger provides a set of methods to output log.
func NewStdLogger ¶
NewStdLogger creates a stdandard logger for logging to stderr.
type Severity ¶
type Severity string
Severity has four classes to correspond with log situation.
const ( // SeverityInfo is for usual log. SeverityInfo Severity = "INFO" // SeverityWarning is for warning. SeverityWarning Severity = "WARN" // SeverityError is for error. SeverityError Severity = "ERROR" // SeverityFatal is for panic error. The severity means that // a logger will output the error and exit immediately. // It can't be recovered. SeverityFatal Severity = "FATAL" )
type SilentLogger ¶
type SilentLogger struct{}
SilentLogger logs nothing.
func (*SilentLogger) Clone ¶
func (l *SilentLogger) Clone(wrapper int) Logger
Clone clones current logger with new wrapper. A positive wrapper indicates how many wrappers outside the logger.
func (*SilentLogger) Error ¶
func (*SilentLogger) Error(...interface{})
Error logs to the ERROR logs. Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func (*SilentLogger) Errorf ¶
func (*SilentLogger) Errorf(string, ...interface{})
Errorf logs to the ERROR logs. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func (*SilentLogger) Errorln ¶
func (*SilentLogger) Errorln(...interface{})
Errorln logs to the ERROR logs. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
func (*SilentLogger) Fatal ¶
func (*SilentLogger) Fatal(v ...interface{})
Fatal logs to the FATAL logs, then calls os.Exit(1). Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func (*SilentLogger) Fatalf ¶
func (*SilentLogger) Fatalf(string, ...interface{})
Fatalf logs to the FATAL logs, then calls os.Exit(1). Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func (*SilentLogger) Fatalln ¶
func (*SilentLogger) Fatalln(v ...interface{})
Fatalln logs to the FATAL logs, then calls os.Exit(1). Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
func (*SilentLogger) Info ¶
func (*SilentLogger) Info(...interface{})
Info logs to the INFO log. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
func (*SilentLogger) Infof ¶
func (*SilentLogger) Infof(string, ...interface{})
Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func (*SilentLogger) Infoln ¶
func (*SilentLogger) Infoln(...interface{})
Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
func (*SilentLogger) V ¶
func (l *SilentLogger) V(Level) Verboser
V reports whether verbosity at the call site is at least the requested level. The returned value is a Verboser, which implements Info, Infof
func (*SilentLogger) Warning ¶
func (*SilentLogger) Warning(...interface{})
Warning logs to the WARNING logs. Arguments are handled in the manner of fmt.Print; a newline is appended if missing.
func (*SilentLogger) Warningf ¶
func (*SilentLogger) Warningf(string, ...interface{})
Warningf logs to the WARNING logs. Arguments are handled in the manner of fmt.Printf; a newline is appended if missing.
func (*SilentLogger) Warningln ¶
func (*SilentLogger) Warningln(...interface{})
Warningln logs to the WARNING logs. Arguments are handled in the manner of fmt.Println; a newline is appended if missing.
type Verboser ¶
type Verboser interface { // Info logs to the INFO log. // Arguments are handled in the manner of fmt.Println; a newline is appended if missing. Info(...interface{}) // Infof logs to the INFO log. // Arguments are handled in the manner of fmt.Printf; a newline is appended if missing. Infof(string, ...interface{}) // Infoln logs to the INFO log. // Arguments are handled in the manner of fmt.Println; a newline is appended if missing. Infoln(...interface{}) }
Verboser is an interface type that implements Info(f|ln) . See the documentation of V for more information.