Skip to content

Conversation

thockin
Copy link
Contributor

@thockin thockin commented Apr 5, 2025

No description provided.


func (l stdoutlogger) WithName(name string) logr.LogSink {
l.Formatter.AddName(name)
l.AddName(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this something that we might want to enable as hint in Kubernetes? Or is it too subjective?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's CORRECT but not obviously BETTER, IMO. I decided not to fight it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.


func BenchmarkSlogSinkLogInfoOneArg(b *testing.B) {
var log logr.Logger = logr.FromSlogHandler(logr.ToSlogHandler(logr.Discard()))
var log logr.Logger = logr.FromSlogHandler(logr.ToSlogHandler(logr.Discard())) //nolint:staticcheck
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to keep the var log logr.Logger = instead of replacing with log :=?

I don't remember why I wrote it like this other than more clearly showing the type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the clarity in the benchmark.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably that was why I did it - if only I remembered... 😅

@pohly pohly merged commit 158c311 into go-logr:master Apr 7, 2025
23 checks passed
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.

2 participants