mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 14:22:26 -05: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:
parent
747c251df6
commit
77b095a8c3
17 changed files with 292 additions and 204 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue