1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-26 15:16:27 +01:00

feat: adds warning as possible level

This commit is contained in:
Amir Raminfar
2023-05-26 10:58:08 -07:00
parent ecf5fda53e
commit cc7d834e35
2 changed files with 3 additions and 2 deletions

View File

@@ -55,7 +55,8 @@ div {
background-color: var(--red-color);
}
&.warn {
&.warn,
&.warning {
background-color: var(--orange-color);
}
}

View File

@@ -130,7 +130,7 @@ var ANSI_COLOR_REGEX = regexp.MustCompile(`\x1b\[[0-9;]*m`)
func guessLogLevel(logEvent *LogEvent) string {
switch value := logEvent.Message.(type) {
case string:
levels := []string{"error", "warn", "info", "debug", "trace", "fatal"}
levels := []string{"error", "warn", "warning", "info", "debug", "trace", "fatal"}
stripped := ANSI_COLOR_REGEX.ReplaceAllString(value, "") // remove ansi color codes
for _, level := range levels {
if match, _ := regexp.MatchString("(?i)^"+level+"[^a-z]", stripped); match {