aboutsummaryrefslogtreecommitdiff
path: root/llog/llog.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2022-12-23 09:01:17 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2022-12-23 09:01:17 +0100
commit7996f32c43e6963619b8e0b0d789623872e2d23a (patch)
treea9a693e8dee2d3a6a6883578778f4e2cd62fda9c /llog/llog.go
parentb7f5ed4e5fcb3b51636a9dad79e7e80f7ebbb102 (diff)
downloadWRMS-7996f32c43e6963619b8e0b0d789623872e2d23a.tar.gz
WRMS-7996f32c43e6963619b8e0b0d789623872e2d23a.zip
make log level configurablev0.0.3-alpha
Diffstat (limited to 'llog/llog.go')
-rw-r--r--llog/llog.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/llog/llog.go b/llog/llog.go
index 52ffc40..3c05012 100644
--- a/llog/llog.go
+++ b/llog/llog.go
@@ -18,6 +18,16 @@ const (
var Level LogLevel = l_DDebug
+func SetLogLevelFromString(level string) {
+ for i, l := range getLevelNames() {
+ if l == level {
+ Level = LogLevel(i)
+ return
+ }
+ }
+ Error(fmt.Sprintf("Invalid log level: %s", level))
+}
+
func getLevelNames() []string {
return []string{"Fatal", "Error", "Warning", "Info", "Debug", "DDebug"}
}