mirror of
https://github.com/amir20/dozzle.git
synced 2026-01-02 19:17:37 +01:00
Updates logic to find ERROR in logs
This commit is contained in:
@@ -130,12 +130,15 @@ var KEY_VALUE_REGEX = regexp.MustCompile(`level=(\w+)`)
|
||||
func guessLogLevel(logEvent *LogEvent) string {
|
||||
switch value := logEvent.Message.(type) {
|
||||
case string:
|
||||
value = NON_ASCII_REGEX.ReplaceAllString(strings.ToLower(value), "")
|
||||
|
||||
levels := []string{"error", "warn", "info", "debug", "trace", "fatal"}
|
||||
for _, level := range levels {
|
||||
prefix := regexp.MustCompile("^" + level + "[^a-z]")
|
||||
if prefix.MatchString(value) {
|
||||
prefix := regexp.MustCompile("(?i)^" + level + "[^a-z]")
|
||||
if prefix.MatchString(NON_ASCII_REGEX.ReplaceAllString(value, "")) {
|
||||
return level
|
||||
}
|
||||
|
||||
if strings.Contains(value, " "+strings.ToUpper(level)+" ") {
|
||||
return level
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user