Skip to content

Change log message to V(2), be sure to pass strings so it doesn't panic #1069

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

Merged
merged 3 commits into from
Sep 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (c *Config) AutoDetect() error {
return err
}
c.autoscalingVersion = hpaVersion
c.logger.Info("In Autodetect, Set HPA version to [", c.autoscalingVersion, "] from [", hpaVersion, "]")
c.logger.V(2).Info("In Autodetect, Set HPA version to [", c.autoscalingVersion.String(), "] from [", hpaVersion.String(), "]")
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't autoscalingVersion and hpaVersion the same value?

Also - the first string is a message but the remaining in the list are key value pairs, leaving the values as ] from [ and ] - is this what we want?

I tried to fix this when I was working on an operator change and came up with:

c.logger.Info("In Autodetect, Set HPA version", "from", c.autoscalingVersion, "to", hpaVersion)

Copy link
Member

Choose a reason for hiding this comment

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

+1, after the log message follows a list of key-value pairs. so it should be something like info("message line", "param1-name", param1-value)

Regarding the v(2). It makes sense to use the lowest value, however if the codebase already uses v(2) as a debug level then 2 is fine.


return nil
}
Expand Down