klog/std.go

90 lines
1.3 KiB
Go

package klog
import (
"io"
)
var std = New("")
func DefaultLogger() *Logger {
return std
}
func SetPrinter(p Printer) {
std.SetPrinter(p)
}
func GetPrinter() Printer {
return std.GetPrinter()
}
func SetPrinterAll(p Printer) {
for _, v := range getAllOffsprings(std) {
v.SetPrinter(p)
}
}
func M(s interface{}, attrs ...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...)
}