add warn log level
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
a606813fdf
commit
70d0029658
@ -14,6 +14,7 @@ type Level int
|
|||||||
const (
|
const (
|
||||||
LevelFatal Level = iota
|
LevelFatal Level = iota
|
||||||
LevelInfo
|
LevelInfo
|
||||||
|
LevelWarn
|
||||||
LevelDebug
|
LevelDebug
|
||||||
LevelTrace
|
LevelTrace
|
||||||
)
|
)
|
||||||
@ -36,6 +37,8 @@ func init() {
|
|||||||
level = LevelTrace
|
level = LevelTrace
|
||||||
case "fatal":
|
case "fatal":
|
||||||
level = LevelFatal
|
level = LevelFatal
|
||||||
|
case "warn":
|
||||||
|
level = LevelWarn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +98,16 @@ func Infof(format string, v ...interface{}) {
|
|||||||
WithLevelf(LevelInfo, format, v...)
|
WithLevelf(LevelInfo, 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...)
|
||||||
|
}
|
||||||
|
|
||||||
// Fatal logs with Log and then exits with os.Exit(1)
|
// Fatal logs with Log and then exits with os.Exit(1)
|
||||||
func Fatal(v ...interface{}) {
|
func Fatal(v ...interface{}) {
|
||||||
WithLevel(LevelFatal, v...)
|
WithLevel(LevelFatal, v...)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user