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

[8.x](backport #5346) Improve testing logger #5448

Closed
wants to merge 1 commit into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Sep 6, 2024

What does this PR do?

Adds a PrettyPrintf method to ObservedLogs to logger.NewTesting

Why is it important?

The testing logger is helpful, however on every failed test it's necessary to manually format the logs before printing. That leads to several tests just printing the logs as they are which isn't the best for reading them and investigating why the test failed.

The new PrettyPrintf method provides an easy way to pretty print the logs

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in ./changelog/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

Disruptive User Impact

None

How to test this PR locally

run the test TestObservedLogs_PrettyPrintf

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

This is an automatic backport of pull request #5346 done by [Mergify](https://mergify.com).

* add loggertesting package

move logger.NewTesting to loggertesting.New
add loggertesting.PrintObservedLogs to pretty print logs from a observer.ObservedLogs

(cherry picked from commit 0126540)
@mergify mergify bot requested a review from a team as a code owner September 6, 2024 06:36
@mergify mergify bot added the backport label Sep 6, 2024
@mergify mergify bot requested review from michel-laterman and swiatekm and removed request for a team September 6, 2024 06:36
Copy link
Contributor Author

mergify bot commented Sep 9, 2024

This pull request has not been merged yet. Could you please review and merge it @AndersonQ? 🙏

@AndersonQ
Copy link
Member

8.x will be recreated, this PR isn't needed any more

@AndersonQ AndersonQ closed this Sep 10, 2024
@AndersonQ AndersonQ deleted the mergify/bp/8.x/pr-5346 branch September 10, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant