Documentation ¶
Overview ¶
Package log providers a logger with level (DEBUG, INFO, WARN, ERROR, FATAL, PANIC).
Index ¶
- Variables
- func Debug(args ...interface{})
- func Debugf(fmt string, args ...interface{})
- func Debugln(args ...interface{})
- func Error(args ...interface{})
- func Errorf(fmt string, args ...interface{})
- func Errorln(args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(fmt string, args ...interface{})
- func Fatalln(args ...interface{})
- func Info(args ...interface{})
- func Infof(fmt string, args ...interface{})
- func Infoln(args ...interface{})
- func Panic(args ...interface{})
- func Panicf(fmt string, args ...interface{})
- func Panicln(args ...interface{})
- func Warn(args ...interface{})
- func Warnf(fmt string, args ...interface{})
- func Warnln(args ...interface{})
- type Level
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Debugln(args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Errorln(args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Fatalln(args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Infoln(args ...interface{})
- func (l *Logger) Level() Level
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Panicln(args ...interface{})
- func (l *Logger) Prefix() string
- func (l *Logger) SetLevel(v Level)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) SetPrefix(v string)
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) Warnln(args ...interface{})
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultLogger represents the default logger. DefaultLogger = NewLogger(os.Stdout, "") )
Functions ¶
func Debugf ¶
func Debugf(fmt string, args ...interface{})
Debugf is short for DefaultLogger.Debugf.
func Errorf ¶
func Errorf(fmt string, args ...interface{})
Errorf is short for DefaultLogger.Errorf.
func Fatalf ¶
func Fatalf(fmt string, args ...interface{})
Fatalf is short for DefaultLogger.Fatalf.
Types ¶
type Level ¶
type Level byte
Level represents the level of log.
const ( // LevelOff represents turn off all logs. LevelOff Level = iota // LevelPanic turns on: panic logs only. LevelPanic // LevelFatal turns on: panic & fatal logs. LevelFatal // LevelError turns on: panic & fatal & error logs. LevelError // LevelWarn turns on: panic & fatal & error & warn logs. LevelWarn // LevelInfo turns on: panic & fatal & error & warn & info logs. LevelInfo // LevelDebug turns on: panic & fatal & error & warn & info & debug logs. LevelDebug // LevelAll turns on all logs. LevelAll )
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger represents a level logger.
func (*Logger) Debug ¶
func (l *Logger) Debug(args ...interface{})
Debug outputs debug log. Arguments are handled in the manner of fmt.Print.
func (*Logger) Debugf ¶
Debugf outputs debug log. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Debugln ¶
func (l *Logger) Debugln(args ...interface{})
Debugln outputs debug log. Arguments are handled in the manner of fmt.Println.
func (*Logger) Error ¶
func (l *Logger) Error(args ...interface{})
Error outputs error log. Arguments are handled in the manner of fmt.Print.
func (*Logger) Errorf ¶
Errorf outputs error log. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Errorln ¶
func (l *Logger) Errorln(args ...interface{})
Errorln outputs error log. Arguments are handled in the manner of fmt.Println.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(args ...interface{})
Fatal outputs fatal log followed by a call to os.Exit(1). Arguments are handled in the manner of fmt.Print.
func (*Logger) Fatalf ¶
Fatalf outputs fatal log followed by a call to os.Exit(1). Arguments are handled in the manner of fmt.Printf.
func (*Logger) Fatalln ¶
func (l *Logger) Fatalln(args ...interface{})
Fatalln outputs fatal log followed by a call to os.Exit(1). Arguments are handled in the manner of fmt.Println.
func (*Logger) Info ¶
func (l *Logger) Info(args ...interface{})
Info outputs info log. Arguments are handled in the manner of fmt.Print.
func (*Logger) Infoln ¶
func (l *Logger) Infoln(args ...interface{})
Infoln outputs info log. Arguments are handled in the manner of fmt.Println.
func (*Logger) Panic ¶
func (l *Logger) Panic(args ...interface{})
Panic outputs panic log followed by a call to panic. Arguments are handled in the manner of fmt.Print.
func (*Logger) Panicf ¶
Panicf outputs panic log followed by a call to panic. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Panicln ¶
func (l *Logger) Panicln(args ...interface{})
Panicln outputs panic log followed by a call to panic. Arguments are handled in the manner of fmt.Println.
func (*Logger) Warn ¶
func (l *Logger) Warn(args ...interface{})
Warn outputs warn log. Arguments are handled in the manner of fmt.Print.