Documentation ¶
Index ¶
- func ChangeDefaultLevelHandler() (string, http.HandlerFunc)
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func SetOutput(w io.Writer)
- func SetOutputLevel(lvl Level)
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- type BaseLogger
- type Level
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeDefaultLevelHandler ¶
func ChangeDefaultLevelHandler() (string, http.HandlerFunc)
ChangeDefaultLevelHandler returns http handler of default log level modify API
func SetOutputLevel ¶
func SetOutputLevel(lvl Level)
Types ¶
type BaseLogger ¶
type BaseLogger interface { Printf(format string, v ...interface{}) Println(v ...interface{}) Debugf(format string, v ...interface{}) Debug(v ...interface{}) Infof(format string, v ...interface{}) Info(v ...interface{}) Warnf(format string, v ...interface{}) Warn(v ...interface{}) Errorf(format string, v ...interface{}) Error(v ...interface{}) Fatalf(format string, v ...interface{}) Fatal(v ...interface{}) Panicf(format string, v ...interface{}) Panic(v ...interface{}) }
BaseLogger defines interface of application log apis.
type Level ¶
type Level int
Level type log level
func GetOutputLevel ¶
func GetOutputLevel() Level
func (*Level) UnmarshalJSON ¶
UnmarshalJSON unserialize log level with json. Try compatible digit firstly then string.
func (*Level) UnmarshalYAML ¶
UnmarshalYAML unserialize log level with yaml.
type Logger ¶
type Logger interface { BaseLogger // atomically control log level GetOutputLevel() Level SetOutputLevel(logLevel Level) SetOutput(w io.Writer) Output(id string, lvl Level, calldepth int, s string) error // implement raft Logger with these two function Warningf(format string, v ...interface{}) Warning(v ...interface{}) }
Logger a implemented logger should implements all these function.
var DefaultLogger Logger
DefaultLogger default logger initial with os.Stderr.
Click to show internal directories.
Click to hide internal directories.