summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-11-10 14:37:36 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-11-10 14:37:36 +0100
commita303e073301ffecdddea003cbae72f2f953a0ab7 (patch)
tree5261a2f1f66cb926472e71532b32be564a040613
parent94c23eafbec388124b7fd43f8eceeb7d8d830b61 (diff)
Logging: Add a Debug level
This makes the levels more logical
-rw-r--r--client/client.go2
-rw-r--r--internal/log/log.go10
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)
}