Skip to content

Commit

Permalink
fixed panic when keyvals len equals 1
Browse files Browse the repository at this point in the history
  • Loading branch information
vicluq committed Nov 6, 2024
1 parent cea7aa5 commit 83843a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/kgo/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ func (b *basicLogger) Log(level LogLevel, msg string, keyvals ...any) {
if len(keyvals) > 0 {
buf.WriteString("; ")
format := strings.Repeat("%v: %v, ", len(keyvals)/2)
format = format[:len(format)-2] // trim trailing comma and space
if len(format) > 1 {
format = format[:len(format)-2] // trim trailing comma and space
}
fmt.Fprintf(buf, format, keyvals...)
}

Expand Down

0 comments on commit 83843a5

Please sign in to comment.