Skip to content

Conversation

@lahabana
Copy link
Contributor

@lahabana lahabana commented Jan 9, 2024

Description

Fixes #1383.

This enables users to not log messages like: "Configuring Kubernetes client using config file"

TODOs

Read the Gruntwork contribution guidelines.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Added option ConfigLogger in KubectlOptions to specify a custom logger for configuration

Migration Guide

@lahabana
Copy link
Contributor Author

@denis256 any chance to get that in?

RestConfig *rest.Config
Logger *logger.Logger
// ConfigLogger is useful to set a different logger when configuring kubectl with a config. This can significantly reduce verbosity of tests
ConfigLogger *logger.Logger
Copy link
Member

Choose a reason for hiding this comment

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

Hm, what will happen if the logger will not be provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logger falls back to the Default logger if it's nil. This also enables backward compatibility

// methods can be called on (typed) nil pointers. In this case, use the Default function to log. This enables the
// caller to do `var l *Logger` and then use the logger already.
if l == nil || l.l == nil {
Default.Logf(t, format, args...)
return
}
l.l.Logf(t, format, args...)

@lahabana
Copy link
Contributor Author

@denis256 sorry I didn't notice you commented on the PR.

This enables users to not log messages like: "Configuring Kubernetes
client using config file"

Fix gruntwork-io#1383

Signed-off-by: Charly Molter <[email protected]>
@lahabana
Copy link
Contributor Author

@denis256 friendly ping on this :) It would greatly help our test logs to be a lot more readable :)

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.

reduce logging when configuring kubectl

2 participants