From a303e073301ffecdddea003cbae72f2f953a0ab7 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Thu, 10 Nov 2022 14:37:36 +0100 Subject: Logging: Add a Debug level This makes the levels more logical --- client/client.go | 2 +- internal/log/log.go | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/client.go b/client/client.go index 0f9f536..da765c1 100644 --- a/client/client.go +++ b/client/client.go @@ -92,7 +92,7 @@ func (client *Client) Register( // Initialize the logger logLevel := log.LOG_WARNING if debug { - logLevel = log.LOG_INFO + logLevel = log.LOG_DEBUG } loggerErr := client.Logger.Init(logLevel, directory) diff --git a/internal/log/log.go b/internal/log/log.go index 1992a88..f8326eb 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -21,7 +21,9 @@ type LogLevel int8 const ( // No level set, not allowed LOG_NOTSET LogLevel = iota - // Log info, this message is not an error + // Log debug, this message is not an error but is there for debugging + LOG_DEBUG + // Log info, this message is not an error but is there for additional information LOG_INFO // Log only to provide a warning, the app still functions LOG_WARNING @@ -35,6 +37,8 @@ func (e LogLevel) String() string { switch e { case LOG_NOTSET: return "NOTSET" + case LOG_DEBUG: + return "DEBUG" case LOG_INFO: return "INFO" case LOG_WARNING: @@ -86,6 +90,10 @@ func (logger *FileLogger) Inherit(label string, err error) { } } +func (logger *FileLogger) Debug(msg string) { + logger.log(LOG_DEBUG, msg) +} + func (logger *FileLogger) Info(msg string) { logger.log(LOG_INFO, msg) } -- cgit v1.2.3