diff options
Diffstat (limited to 'llog')
| -rw-r--r-- | llog/llog.go | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/llog/llog.go b/llog/llog.go index 3c05012..f7a5486 100644 --- a/llog/llog.go +++ b/llog/llog.go @@ -44,38 +44,41 @@ func (l LogLevel) String() string { return getLevelNames()[l-1] } -func Log(l LogLevel, msg string) { +func Log(l LogLevel, format string, a ...any) { + if l > Level { + return + } + + msg := fmt.Sprintf(format, a...) msg = fmt.Sprintf("[%s] %s", l.String(), msg) if l == l_Fatal { log.Fatalln(msg) - } - - if l <= Level { + } else { log.Println(msg) } } -func Fatal(msg string) { - Log(l_Fatal, msg) +func Fatal(format string, a ...any) { + Log(l_Fatal, format, a...) } -func Error(msg string) { - Log(l_Error, msg) +func Error(format string, a ...any) { + Log(l_Error, format, a...) } -func Warning(msg string) { - Log(l_Warning, msg) +func Warning(format string, a ...any) { + Log(l_Warning, format, a...) } -func Info(msg string) { - Log(l_Info, msg) +func Info(format string, a ...any) { + Log(l_Info, format, a...) } -func Debug(msg string) { - Log(l_Debug, msg) +func Debug(format string, a ...any) { + Log(l_Debug, format, a...) } -func DDebug(msg string) { - Log(l_DDebug, msg) +func DDebug(format string, a ...any) { + Log(l_DDebug, format, a...) } |
