mirror of https://github.com/shunfei/cronsun
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
903 B
48 lines
903 B
package log
|
|
|
|
var (
|
|
DefaultLogger Logger
|
|
)
|
|
|
|
type Logger interface {
|
|
Debugf(format string, v ...interface{})
|
|
Infof(format string, v ...interface{})
|
|
Warnf(format string, v ...interface{})
|
|
Errorf(format string, v ...interface{})
|
|
Fatalf(format string, v ...interface{})
|
|
}
|
|
|
|
func SetLogger(l Logger) {
|
|
DefaultLogger = l
|
|
}
|
|
|
|
func Debugf(format string, v ...interface{}) {
|
|
if DefaultLogger != nil {
|
|
DefaultLogger.Debugf(format, v...)
|
|
}
|
|
}
|
|
|
|
func Infof(format string, v ...interface{}) {
|
|
if DefaultLogger != nil {
|
|
DefaultLogger.Infof(format, v...)
|
|
}
|
|
}
|
|
|
|
func Warnf(format string, v ...interface{}) {
|
|
if DefaultLogger != nil {
|
|
DefaultLogger.Warnf(format, v...)
|
|
}
|
|
}
|
|
|
|
func Errorf(format string, v ...interface{}) {
|
|
if DefaultLogger != nil {
|
|
DefaultLogger.Errorf(format, v...)
|
|
}
|
|
}
|
|
|
|
func Fatalf(format string, v ...interface{}) {
|
|
if DefaultLogger != nil {
|
|
DefaultLogger.Fatalf(format, v...)
|
|
}
|
|
}
|