Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logger: ensure compatibility with new log/slog package #1247

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kevinburkesegment
Copy link
Contributor

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

@kevinburkesegment
Copy link
Contributor Author

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

The API for the logger changes only slightly and should continue
to be backwards compatible for any existing code.
@@ -1,13 +1,22 @@
module github.com/segmentio/kafka-go

go 1.15
go 1.18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a separate PR for upgrading the Go version. Since kafka-go is so widely used this will be a breaking change for some users and the more explicit we can make that the less of a surprise it will be to users

environment:
KAFKA_VERSION: "0.10.1"
docker:
- image: circleci/golang
- image: cimg/go:1.21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be best to test against the same Go version that is in our go.mod file

@petedannemann
Copy link
Contributor

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

@kevinburkesegment
Copy link
Contributor Author

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

Sure, if you have time that would be great.

@jackwilsdon
Copy link

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:

l.Printf("started commit for group %s\n", r.config.GroupID)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants