88 lines
1.3 KiB
Go
88 lines
1.3 KiB
Go
package klog
|
|
|
|
import (
|
|
"io"
|
|
|
|
"kumoly.io/lib/klog/color"
|
|
)
|
|
|
|
var std = New("")
|
|
|
|
func DefaultLogger() *Logger {
|
|
return std
|
|
}
|
|
|
|
func SetPrinter(p Printer) {
|
|
std.printer = p
|
|
}
|
|
|
|
func SetPrinterAll(p Printer) {
|
|
for _, v := range getAllOffsprings(std) {
|
|
v.SetPrinter(p)
|
|
}
|
|
}
|
|
|
|
func M(s interface{}, attrs ...color.Attribute) string {
|
|
return std.M(s, attrs...)
|
|
}
|
|
|
|
func Sub(sys string) *Logger {
|
|
return std.Sub(sys)
|
|
}
|
|
|
|
func SetColor(c bool) {
|
|
std.SetColor(c)
|
|
}
|
|
|
|
func SetColorAll(c bool) {
|
|
std.SetColorAll(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 ErrorF(fields H, v ...interface{}) {
|
|
std.output(Lerror, 3, fields, v...)
|
|
}
|
|
|
|
func Error(v ...interface{}) {
|
|
std.output(Lerror, 3, H{}, v...)
|
|
}
|
|
|
|
func DebugF(fields H, v ...interface{}) {
|
|
std.output(Ldebug, 3, fields, v...)
|
|
}
|
|
|
|
func Debug(v ...interface{}) {
|
|
std.output(Ldebug, 3, H{}, v...)
|
|
}
|
|
|
|
func WarnF(fields H, v ...interface{}) {
|
|
std.output(Lwarn, 3, fields, v...)
|
|
}
|
|
|
|
func Warn(v ...interface{}) {
|
|
std.output(Lwarn, 3, H{}, v...)
|
|
}
|
|
|
|
func InfoF(fields H, v ...interface{}) {
|
|
std.output(Linfo, 3, fields, v...)
|
|
}
|
|
|
|
func Info(v ...interface{}) {
|
|
std.output(Linfo, 3, H{}, v...)
|
|
}
|