Skip to content

Commit

Permalink
fix: fixes log levels that are not in the start of the line
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 committed Oct 24, 2023
1 parent be11c32 commit 74e44bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docker/level_guesser.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func init() {
}

for _, level := range LOG_LEVELS {
LOG_LEVEL_BRACKET[level] = regexp.MustCompile("(?i)^\\[ ?" + level + " ?\\]")
LOG_LEVEL_BRACKET[level] = regexp.MustCompile("(?i)\\[ ?" + level + " ?\\]")
}
}

Expand Down
2 changes: 2 additions & 0 deletions docker/level_guesser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ func TestGuessLogLevel(t *testing.T) {
{"[error] Something went wrong", "error"},
{"[ ERROR ] Something went wrong", "error"},
{"[error] Something went wrong", "error"},
{"[test] [error] Something went wrong", "error"},
{"[foo] [ ERROR] Something went wrong", "error"},
{"123 ERROR Something went wrong", "error"},
{"123 Something went wrong", ""},
}
Expand Down

0 comments on commit 74e44bd

Please sign in to comment.