-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
add possibility to setup a custom logger for kubectl configuration #1384
base: main
Are you sure you want to change the base?
Conversation
@denis256 any chance to get that in? |
@@ -15,6 +15,8 @@ type KubectlOptions struct { | |||
InClusterAuth bool | |||
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
terratest/modules/logger/logger.go
Lines 63 to 70 in 6fb8605
// 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...) |
@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 <charly.molter@konghq.com>
@denis256 friendly ping on this :) It would greatly help our test logs to be a lot more readable :) |
Description
Fixes #1383.
This enables users to not log messages like: "Configuring Kubernetes client using config file"
TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added option
ConfigLogger
inKubectlOptions
to specify a custom logger for configurationMigration Guide