From f772a21f37266163dc60be683b71e670eca0d797 Mon Sep 17 00:00:00 2001 From: Viktor Liu Date: Thu, 2 Jan 2025 19:02:25 +0100 Subject: [PATCH] Fix log level handling --- client/firewall/uspfilter/log/log.go | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/client/firewall/uspfilter/log/log.go b/client/firewall/uspfilter/log/log.go index 02f108561..1b27fd762 100644 --- a/client/firewall/uspfilter/log/log.go +++ b/client/firewall/uspfilter/log/log.go @@ -113,33 +113,33 @@ func (l *Logger) log(level Level, format string, args ...interface{}) { l.bufPool.Put(bufp) } -func (l *Logger) Trace(format string, args ...interface{}) { - if l.level.Load() <= uint32(LevelTrace) { - l.log(LevelTrace, format, args...) - } -} - -func (l *Logger) Debug(format string, args ...interface{}) { - if l.level.Load() <= uint32(LevelDebug) { - l.log(LevelDebug, format, args...) - } -} - -func (l *Logger) Info(format string, args ...interface{}) { - if l.level.Load() <= uint32(LevelInfo) { - l.log(LevelInfo, format, args...) +func (l *Logger) Error(format string, args ...interface{}) { + if l.level.Load() >= uint32(LevelError) { + l.log(LevelError, format, args...) } } func (l *Logger) Warn(format string, args ...interface{}) { - if l.level.Load() <= uint32(LevelWarn) { + if l.level.Load() >= uint32(LevelWarn) { l.log(LevelWarn, format, args...) } } -func (l *Logger) Error(format string, args ...interface{}) { - if l.level.Load() <= uint32(LevelError) { - l.log(LevelError, format, args...) +func (l *Logger) Info(format string, args ...interface{}) { + if l.level.Load() >= uint32(LevelInfo) { + l.log(LevelInfo, format, args...) + } +} + +func (l *Logger) Debug(format string, args ...interface{}) { + if l.level.Load() >= uint32(LevelDebug) { + l.log(LevelDebug, format, args...) + } +} + +func (l *Logger) Trace(format string, args ...interface{}) { + if l.level.Load() >= uint32(LevelTrace) { + l.log(LevelTrace, format, args...) } }