Documentation
¶
Index ¶
- Variables
- 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 Trace(v ...interface{})
- func Tracef(format string, v ...interface{})
- func Warning(v ...interface{})
- func Warningf(format string, v ...interface{})
- type Level
- type Log
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLogger = New(DefaultOptions)
View Source
var DefaultOptions = &Options{ Level: DEBUG, }
View Source
var New = func(opts *Options) *logger { out := os.Stdout if opts.Path != "" { logFile, err := os.OpenFile(opts.Path, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0666) if err != nil { fmt.Println("open file, ERROR : ", err) } out = logFile } return &logger{ log.New(out, fmt.Sprintf("%s[DRACARYS]%s", dracarys, reset), log.LstdFlags|log.Lshortfile), opts, } }
Functions ¶
Types ¶
type Log ¶
type Log interface {
Trace(v ...interface{})
Debug(v ...interface{})
Info(v ...interface{})
Warning(v ...interface{})
Error(v ...interface{})
Fatal(v ...interface{})
Tracef(format string, v ...interface{})
Debugf(format string, v ...interface{})
Infof(format string, v ...interface{})
Warningf(format string, v ...interface{})
Errorf(format string, v ...interface{})
Fatalf(format string, v ...interface{})
}
Log 日志接口. 可以自行实现,实现后注入DefaultLogger即可使用自定义.
Click to show internal directories.
Click to hide internal directories.