Skip to content

Commit

Permalink
feat: checks level with equal sign (#3368)
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 authored Nov 2, 2024
1 parent 46d124b commit d529ed7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/docker/level_guesser.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ func guessLogLevel(logEvent *LogEvent) string {
if strings.Contains(value, " "+strings.ToUpper(level)+" ") {
return level
}

// Look for levels with equal sign and quotes around them
if strings.Contains(value, level+"=") {
return level
}
}

return "unknown"
Expand Down
1 change: 1 addition & 0 deletions internal/docker/level_guesser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestGuessLogLevel(t *testing.T) {
{"[ ERROR ] Something went wrong", "error"},
{"[error] Something went wrong", "error"},
{"[test] [error] Something went wrong", "error"},
{"Some test with error=test", "error"},
{"[foo] [ ERROR] Something went wrong", "error"},
{"123 ERROR Something went wrong", "error"},
{"123 Something went wrong", "unknown"},
Expand Down

0 comments on commit d529ed7

Please sign in to comment.