summaryrefslogtreecommitdiff
path: root/internal/log/init.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-09-20 13:30:33 +0000
committerLibravatar GitHub <noreply@github.com>2024-09-20 13:30:33 +0000
commit77b095a8c32c423dea495f94babe49d7f169f060 (patch)
tree47d23864fb256823919e2ddeb2ebc75c85421166 /internal/log/init.go
parent[chore/frontend] Make ecks pee theme even more ecks pee er (#3324) (diff)
downloadgotosocial-77b095a8c32c423dea495f94babe49d7f169f060.tar.xz
[chore] ensure consistent caller name fetching regardless of compiler inlining (#3323)
* move logging levels into log package itself * ensure inconsistent inlining doesn't mess with log calling function name * remove unused global variable * fix log level
Diffstat (limited to 'internal/log/init.go')
-rw-r--r--internal/log/init.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/internal/log/init.go b/internal/log/init.go
index 411a599d5..850ae8b5d 100644
--- a/internal/log/init.go
+++ b/internal/log/init.go
@@ -21,25 +21,23 @@ import (
"fmt"
"log/syslog"
"strings"
-
- "codeberg.org/gruf/go-logger/v2/level"
)
-// ParseLevel will parse the log level from given string and set to appropriate level.
+// ParseLevel will parse the log level from given string and set to appropriate LEVEL.
func ParseLevel(str string) error {
switch strings.ToLower(str) {
case "trace":
- SetLevel(level.TRACE)
+ SetLevel(TRACE)
case "debug":
- SetLevel(level.DEBUG)
+ SetLevel(DEBUG)
case "", "info":
- SetLevel(level.INFO)
+ SetLevel(INFO)
case "warn":
- SetLevel(level.WARN)
+ SetLevel(WARN)
case "error":
- SetLevel(level.ERROR)
- case "fatal":
- SetLevel(level.FATAL)
+ SetLevel(ERROR)
+ case "fatal", "panic":
+ SetLevel(PANIC)
default:
return fmt.Errorf("unknown log level: %q", str)
}