kafka-go icon indicating copy to clipboard operation
kafka-go copied to clipboard

logger: ensure compatibility with new log/slog package

Open kevinburkesegment opened this issue 7 months ago • 4 comments

The API for the logger changes only slightly and should continue to be backwards compatible for any existing code.

kevinburkesegment avatar Dec 07 '23 23:12 kevinburkesegment

I've fixed everything with CircleCI except the linters; the error message on the linter is incomprehensible.

kevinburkesegment avatar Dec 08 '23 00:12 kevinburkesegment

I've fixed everything with CircleCI except the linters; the error message on the linter is incomprehensible.

If you'd prefer I can handle the Go version upgrade and linting fixes. Then this PR will just be the change you actually want to make. Let me know what's best for you

petedannemann avatar Jan 03 '24 14:01 petedannemann

If you'd prefer I can handle the Go version upgrade and linting fixes.

Sure, if you have time that would be great.

kevinburkesegment avatar Jan 03 '24 15:01 kevinburkesegment

I'm not sure this compatibility makes sense - Printf accepts a formatting string and values for the placeholders but slog expects key/value pairs after the first argument and does not do any placeholder substitution.

For example:

https://github.com/segmentio/kafka-go/blob/ebca72eaee918d303c532feb7ff29afdcd8c2efa/reader.go#L274

Will cause the following to be logged when using the slog backend:

2009/11/10 23:00:00 INFO started commit for group %s
 !BADKEY=my-group

jackwilsdon avatar Apr 25 '24 09:04 jackwilsdon