Make -debug a global config flag, clean up logger.Debugf() callsites

This commit is contained in:
Pim van Pelt
2025-06-09 18:10:44 +02:00
parent 29d0417452
commit fb3c545e11
5 changed files with 36 additions and 28 deletions

View File

@ -5,6 +5,8 @@ import (
"log"
"path/filepath"
"runtime"
"govpp-snmp-example/config"
)
// logf logs a message with automatic caller information (file:function)
@ -34,9 +36,9 @@ func Printf(format string, args ...interface{}) {
logf(format, args...)
}
// Debugf logs a debug message with caller information if debug is true
func Debugf(debug bool, format string, args ...interface{}) {
if debug {
// Debugf logs a debug message with caller information if global debug is enabled
func Debugf(format string, args ...interface{}) {
if config.Debug {
logf(format, args...)
}
}