aboutsummaryrefslogtreecommitdiff
path: root/llog
diff options
context:
space:
mode:
Diffstat (limited to 'llog')
-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"}
}