Skip to content

Commit

Permalink
fix: format the code
Browse files Browse the repository at this point in the history
  • Loading branch information
yduartep committed Jun 14, 2024
1 parent 880099d commit 29db05f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ func isJSON(line string) bool {
}

func detectLevelFromLogLine(log string) string {
if strings.Contains(log, "info:") || strings.Contains(log, "INFO:") ||
if strings.Contains(log, "info:") || strings.Contains(log, "INFO:") ||
strings.Contains(log, "info") || strings.Contains(log, "INFO") {
return logLevelInfo
}
Expand Down
26 changes: 13 additions & 13 deletions pkg/distributor/distributor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1712,19 +1712,19 @@ func Test_detectLogLevelFromLogEntry(t *testing.T) {
expectedLogLevel: logLevelError,
},
{
name: "json log line with an INFO in block case",
entry: logproto.Entry{
Line: `{"foo":"bar","msg":"message with keyword INFO get picked up"}`,
},
expectedLogLevel: logLevelInfo,
},
{
name: "logfmt log line with an INFO and not level returns info log level",
entry: logproto.Entry{
Line: `foo=bar msg="message with info and not level should get picked up"`,
},
expectedLogLevel: logLevelInfo,
},
name: "json log line with an INFO in block case",
entry: logproto.Entry{
Line: `{"foo":"bar","msg":"message with keyword INFO get picked up"}`,
},
expectedLogLevel: logLevelInfo,
},
{
name: "logfmt log line with an INFO and not level returns info log level",
entry: logproto.Entry{
Line: `foo=bar msg="message with info and not level should get picked up"`,
},
expectedLogLevel: logLevelInfo,
},
{
name: "logfmt log line with a warn",
entry: logproto.Entry{
Expand Down

0 comments on commit 29db05f

Please sign in to comment.