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

Set log.Default's output to io.Discard #115

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

ulucinar
Copy link
Collaborator

Description of your changes

This PR sets a default io.Discard logger for the controller-runtime if debug logging is not enabled. If debug logging is enabled, then the controller-runtime uses a debug mode zap logger as usual.

It also sets the log.Default's output to io.Discard. According to a test with a Application.applications, this prevents the noisy logs from the underlying Terraform provider. We still need to check for direct log messages via the fmt variants, such as fmt.Println.

In a further iteration, we will also consider making the underlying provider's logs available in a structured format.

I have:

  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Tested manually with the Application.applications resource.

@ulucinar
Copy link
Collaborator Author

/test-examples="examples/applications/application.yaml"

if debug logging is not enabled.

- Set log.Default's output to io.Discard.

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
@ulucinar
Copy link
Collaborator Author

/test-examples="examples/applications/application.yaml"

Copy link
Collaborator

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

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

Thanks @ulucinar LGTM!

@ulucinar ulucinar merged commit b5c5d4b into crossplane-contrib:main Mar 21, 2024
10 checks passed
@ulucinar ulucinar deleted the fix-logs branch March 21, 2024 12:07
Copy link

Successfully created backport PR #118 for release-0.15.

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

Successfully merging this pull request may close these issues.

None yet

2 participants