From f73a0bfdf04f3482eb8cb92c0357c2bbb04e8c12 Mon Sep 17 00:00:00 2001 From: Luca Bigliardi Date: Tue, 13 Apr 2021 10:44:23 +0200 Subject: [PATCH] logging: clarify call depth value Signed-off-by: Luca Bigliardi --- logging/logging.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/logging/logging.go b/logging/logging.go index 7651202..d7bf7d6 100644 --- a/logging/logging.go +++ b/logging/logging.go @@ -23,6 +23,10 @@ import ( goirc_logging "github.com/fluffle/goirc/logging" ) +const ( + loggingCallDepth = 3 +) + type Logger interface { Debug(format string, args ...interface{}) Info(format string, args ...interface{}) @@ -40,20 +44,20 @@ var debugFlag = flag.Bool("debug", false, "Enable debug logging.") func (l stdOutLogger) Debug(f string, a ...interface{}) { if *debugFlag { - l.out.Output(3, fmt.Sprintf("DEBUG "+f, a...)) + l.out.Output(loggingCallDepth, fmt.Sprintf("DEBUG "+f, a...)) } } func (l stdOutLogger) Info(f string, a ...interface{}) { - l.out.Output(3, fmt.Sprintf("INFO "+f, a...)) + l.out.Output(loggingCallDepth, fmt.Sprintf("INFO "+f, a...)) } func (l stdOutLogger) Warn(f string, a ...interface{}) { - l.out.Output(3, fmt.Sprintf("WARN "+f, a...)) + l.out.Output(loggingCallDepth, fmt.Sprintf("WARN "+f, a...)) } func (l stdOutLogger) Error(f string, a ...interface{}) { - l.out.Output(3, fmt.Sprintf("ERROR "+f, a...)) + l.out.Output(loggingCallDepth, fmt.Sprintf("ERROR "+f, a...)) } func init() {