klog/std.go

86 lines
1.4 KiB
Go
Raw Normal View History

2021-11-01 14:41:11 +00:00
package log
2021-11-02 03:08:23 +00:00
import "io"
var std = New("")
2021-11-01 14:41:11 +00:00
2021-11-01 18:07:05 +00:00
func Sub(sys string) *Logger {
2021-11-01 14:41:11 +00:00
return std.Sub(sys)
}
2021-11-02 03:08:23 +00:00
func SetColor(c bool) {
std.SetColor(c)
}
func SetErrOutput(err io.Writer) {
std.SetErrOutput(err)
}
func SetErrOutputAll(err io.Writer) {
std.SetErrOutputAll(err)
}
func SetOutput(out io.Writer) {
std.SetOutput(out)
}
func SetOutputAll(out io.Writer) {
std.SetOutputAll(out)
}
func Reload() error {
return std.Reload()
}
func ReloadAll() error {
return std.ReloadAll()
}
2021-11-01 14:41:11 +00:00
func ErrorF(fields H, v ...interface{}) {
if PROD {
std.output(terror, 3, "", fields, v...)
} else {
std.output(terror, 3, stack(), fields, v...)
}
}
func Error(v ...interface{}) {
if PROD {
std.output(terror, 3, "", H{}, v...)
} else {
std.output(terror, 3, stack(), H{}, v...)
}
}
func DebugF(fields H, v ...interface{}) {
if PROD {
std.output(tdebug, 3, "", fields, v...)
} else {
std.output(tdebug, 3, stack(), fields, v...)
}
}
func Debug(v ...interface{}) {
if PROD {
std.output(tdebug, 3, "", H{}, v...)
} else {
std.output(tdebug, 3, stack(), H{}, v...)
}
}
func WarnF(fields H, v ...interface{}) {
std.output(twarn, 3, "", fields, v...)
}
func Warn(v ...interface{}) {
std.output(twarn, 3, "", H{}, v...)
}
func InfoF(fields H, v ...interface{}) {
std.output(tinfo, 3, "", fields, v...)
}
func Info(v ...interface{}) {
std.output(tinfo, 3, "", H{}, v...)
}