From 70d0029658da6118cb83b6f721407fd395517211 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 14 Aug 2019 02:26:51 +0300 Subject: [PATCH] add warn log level Signed-off-by: Vasiliy Tolstov --- util/log/log.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/util/log/log.go b/util/log/log.go index b533f39d..0b911aae 100644 --- a/util/log/log.go +++ b/util/log/log.go @@ -14,6 +14,7 @@ type Level int const ( LevelFatal Level = iota LevelInfo + LevelWarn LevelDebug LevelTrace ) @@ -36,6 +37,8 @@ func init() { level = LevelTrace case "fatal": level = LevelFatal + case "warn": + level = LevelWarn } } @@ -95,6 +98,16 @@ func Infof(format string, v ...interface{}) { 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) func Fatal(v ...interface{}) { WithLevel(LevelFatal, v...)