Documentation
¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func SetFlags(flags int)
- func SetLevel(level Level)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type Level
- type Logger
- type SimpleLogger
- func (l *SimpleLogger) Debug(args ...interface{})
- func (l *SimpleLogger) Debugf(format string, args ...interface{})
- func (l *SimpleLogger) Error(args ...interface{})
- func (l *SimpleLogger) Errorf(format string, args ...interface{})
- func (l *SimpleLogger) Fatal(args ...interface{})
- func (l *SimpleLogger) Fatalf(format string, args ...interface{})
- func (l *SimpleLogger) Info(args ...interface{})
- func (l *SimpleLogger) Infof(format string, args ...interface{})
- func (l *SimpleLogger) Panic(args ...interface{})
- func (l *SimpleLogger) Panicf(format string, args ...interface{})
- func (l *SimpleLogger) SetFlags(flags int)
- func (l *SimpleLogger) SetLevel(level Level)
- func (l *SimpleLogger) Warn(args ...interface{})
- func (l *SimpleLogger) Warnf(format string, args ...interface{})
Constants ¶
const ( Ldate = 1 << iota // the date in the local time zone: 2009/01/23 Ltime // the time in the local time zone: 01:23:23 Lmicroseconds // microsecond resolution: 01:23:23.123123. assumes Ltime. Llongfile // full file name and line number: /a/b/c/d.go:23 Lshortfile // final file name element and line number: d.go:23. overrides Llongfile LUTC // if Ldate or Ltime is set, use UTC rather than the local time zone Lmsgprefix // move the "prefix" from the beginning of the line to before the message LstdFlags = Ldate | Ltime // initial values for the standard logger )
These flags define which text to prefix to each log entry generated by the Logger. Bits are or'ed together to control what's printed. With the exception of the Lmsgprefix flag, there is no control over the order they appear (the order listed here) or the format they present (as described in the comments). The prefix is followed by a colon only when Llongfile or Lshortfile is specified. For example, flags Ldate | Ltime (or LstdFlags) produce,
2009/01/23 01:23:23 message
while flags Ldate | Ltime | Lmicroseconds | Llongfile produce,
2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message
Variables ¶
This section is empty.
Functions ¶
func Debug ¶ added in v1.1.0
func Debug(args ...interface{})
Debug logs on the LevelDebug with the default SimpleLogger
func Debugf ¶ added in v1.1.0
func Debugf(format string, args ...interface{})
Debugf logs on the LevelDebug with the default SimpleLogger
func Error ¶ added in v1.1.0
func Error(args ...interface{})
Error logs on the LevelError with the default SimpleLogger
func Errorf ¶ added in v1.1.0
func Errorf(format string, args ...interface{})
Errorf logs on the LevelError with the default SimpleLogger
func Fatal ¶ added in v1.1.0
func Fatal(args ...interface{})
Fatal logs on the LevelFatal with the default SimpleLogger
func Fatalf ¶ added in v1.1.0
func Fatalf(format string, args ...interface{})
Fatalf logs on the LevelFatal with the default SimpleLogger
func Info ¶ added in v1.1.0
func Info(args ...interface{})
Info logs on the LevelInfo with the default SimpleLogger
func Infof ¶ added in v1.1.0
func Infof(format string, args ...interface{})
Infof logs on the LevelInfo with the default SimpleLogger
func Panic ¶ added in v1.1.0
func Panic(args ...interface{})
Panic logs on the LevelPanic with the default SimpleLogger
func Panicf ¶ added in v1.1.0
func Panicf(format string, args ...interface{})
Panicf logs on the LevelPanic with the default SimpleLogger
func SetFlags ¶ added in v1.1.0
func SetFlags(flags int)
SetFlags sets the log flags like: Ldate, Ltime, Lmicroseconds, Llongfile, Lshortfile, LUTC, Lmsgprefix,LstdFlags of the default Logger
func SetLevel ¶ added in v1.1.0
func SetLevel(level Level)
SetLevel sets the Level of the default Logger
Types ¶
type Level ¶ added in v1.1.0
type Level int
Level are different levels at which the SimpleLogger can log
All Level(s) which SimpleLogger supports
type Logger ¶
type Logger interface {
Debug(args ...interface{})
Info(args ...interface{})
Warn(args ...interface{})
Error(args ...interface{})
Fatal(args ...interface{})
Panic(args ...interface{})
Debugf(format string, args ...interface{})
Infof(format string, args ...interface{})
Warnf(format string, args ...interface{})
Errorf(format string, args ...interface{})
Fatalf(format string, args ...interface{})
Panicf(format string, args ...interface{})
}
Logger is the logging interface you can implement/use
type SimpleLogger ¶ added in v1.1.0
type SimpleLogger struct {
// contains filtered or unexported fields
}
SimpleLogger is a wrapper for the std Logger
func Default ¶ added in v1.1.0
func Default() *SimpleLogger
Default returns the default SimpleLogger
func New ¶ added in v1.1.0
func New(flags int) *SimpleLogger
New returns a new SimpleLogger implementation
func (*SimpleLogger) Debug ¶ added in v1.1.0
func (l *SimpleLogger) Debug(args ...interface{})
Debug logs on the LevelDebug
func (*SimpleLogger) Debugf ¶ added in v1.1.0
func (l *SimpleLogger) Debugf(format string, args ...interface{})
Debugf logs on the LevelDebug
func (*SimpleLogger) Error ¶ added in v1.1.0
func (l *SimpleLogger) Error(args ...interface{})
Error logs on the LevelError
func (*SimpleLogger) Errorf ¶ added in v1.1.0
func (l *SimpleLogger) Errorf(format string, args ...interface{})
Errorf logs on the LevelError
func (*SimpleLogger) Fatal ¶ added in v1.1.0
func (l *SimpleLogger) Fatal(args ...interface{})
Fatal logs on the LevelFatal
func (*SimpleLogger) Fatalf ¶ added in v1.1.0
func (l *SimpleLogger) Fatalf(format string, args ...interface{})
Fatalf logs on the LevelFatal
func (*SimpleLogger) Info ¶ added in v1.1.0
func (l *SimpleLogger) Info(args ...interface{})
Info logs on the LevelInfo
func (*SimpleLogger) Infof ¶ added in v1.1.0
func (l *SimpleLogger) Infof(format string, args ...interface{})
Infof logs on the LevelInfo
func (*SimpleLogger) Panic ¶ added in v1.1.0
func (l *SimpleLogger) Panic(args ...interface{})
Panic logs on the LevelPanic
func (*SimpleLogger) Panicf ¶ added in v1.1.0
func (l *SimpleLogger) Panicf(format string, args ...interface{})
Panicf logs on the LevelPanic
func (*SimpleLogger) SetFlags ¶ added in v1.1.0
func (l *SimpleLogger) SetFlags(flags int)
SetFlags sets the log flags like: Ldate, Ltime, Lmicroseconds, Llongfile, Lshortfile, LUTC, Lmsgprefix,LstdFlags
func (*SimpleLogger) SetLevel ¶ added in v1.1.0
func (l *SimpleLogger) SetLevel(level Level)
SetLevel sets the lowest Level to log for
func (*SimpleLogger) Warn ¶ added in v1.1.0
func (l *SimpleLogger) Warn(args ...interface{})
Warn logs on the LevelWarn
func (*SimpleLogger) Warnf ¶ added in v1.1.0
func (l *SimpleLogger) Warnf(format string, args ...interface{})
Warnf logs on the LevelWarn