haiwai-grlogs/grlogs.go
2020-05-06 14:32:26 +08:00

60 lines
1.2 KiB
Go

package grlogs
import "strings"
func Info(v ...interface{}) {
Get("grlogs").Info(generateFmtStr(len(v)), v...)
}
func Informational(v ...interface{}) {
Get("grlogs").Informational(generateFmtStr(len(v)), v...)
}
func Warning(v ...interface{}) {
Get("grlogs").Warning(generateFmtStr(len(v)), v...)
}
func Warn(v ...interface{}) {
Get("grlogs").Warn(generateFmtStr(len(v)), v...)
}
func Notice(v ...interface{}) {
Get("grlogs").Notice(generateFmtStr(len(v)), v...)
}
func Error(v ...interface{}) {
Get("grlogs").Error(generateFmtStr(len(v)), v...)
}
func Critical(v ...interface{}) {
Get("grlogs").Critical(generateFmtStr(len(v)), v...)
}
func Alert(v ...interface{}) {
Get("grlogs").Alert(generateFmtStr(len(v)), v...)
}
func Emergency(v ...interface{}) {
Get("grlogs").Emergency(generateFmtStr(len(v)), v...)
}
func Trace(v ...interface{}) {
Get("grlogs").Trace(generateFmtStr(len(v)), v...)
}
func Debug(v ...interface{}) {
Get("grlogs").Debug(generateFmtStr(len(v)), v...)
}
func generateFmtStr(n int) string {
return strings.Repeat("%v ", n)
}
func SetAdapter(level Level, adapter Adapter) {
Get("grlogs").SetAdapter(level, adapter)
}
func DropAdapter(adapter Adapter) {
Get("grlogs").DropAdapter(adapter)
}