fix# Change the Log level and add WarnLevel (#935)

* fix# Change the Log level and add WarnLevel

* fix# Change the Log level and add WarnLevel
This commit is contained in:
Huang.X 2019-11-11 15:57:14 +08:00 committed by Asim Aslam
parent 5ae3e179b9
commit 5ffe367cae

View File

@ -14,8 +14,9 @@ type Level int
const ( const (
LevelFatal Level = iota LevelFatal Level = iota
LevelInfo
LevelError LevelError
LevelInfo
LevelWarn
LevelDebug LevelDebug
LevelTrace LevelTrace
) )
@ -37,6 +38,8 @@ func init() {
level = LevelTrace level = LevelTrace
case "debug": case "debug":
level = LevelDebug level = LevelDebug
case "warn":
level = LevelWarn
case "info": case "info":
level = LevelInfo level = LevelInfo
case "error": case "error":
@ -99,6 +102,16 @@ func Debugf(format string, v ...interface{}) {
WithLevelf(LevelDebug, format, v...) WithLevelf(LevelDebug, format, v...)
} }
// Warn provides warn level logging
func Warn(v ...interface{}) {
WithLevel(LevelWarn, v...)
}
// Warnf provides warn level logging
func Warnf(format string, v ...interface{}) {
WithLevelf(LevelWarn, format, v...)
}
// Info provides info level logging // Info provides info level logging
func Info(v ...interface{}) { func Info(v ...interface{}) {
WithLevel(LevelInfo, v...) WithLevel(LevelInfo, v...)