mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user