Skip to content

Commit

Permalink
fix: omitted log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianKramm committed Apr 19, 2024
1 parent 1e65a29 commit 8116048
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/util/loghelper/klog.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func PrintKlogLine(line string, args []interface{}) {
}

func parseStructuredLogging(line string) (string, []interface{}) {
originalLine := strings.TrimSpace(line)
if len(line) == 0 {
return line, nil
}
Expand All @@ -42,6 +43,11 @@ func parseStructuredLogging(line string) (string, []interface{}) {
retArgs := []interface{}{}
for line != "" {
if !structuredComponent.MatchString(line) {
if strings.TrimSpace(line) != "" {
// there seems to be a problem with parsing, so just return original line
return originalLine, nil
}

break
}

Expand All @@ -56,7 +62,7 @@ func parseStructuredLogging(line string) (string, []interface{}) {
} else {
retArgs = append(retArgs, name)
value, restOfLine := parseQuotedMessage(line, false)
retArgs = append(retArgs, value)
retArgs = append(retArgs, strings.TrimSpace(value))

line = restOfLine
}
Expand Down

0 comments on commit 8116048

Please sign in to comment.