-
Notifications
You must be signed in to change notification settings - Fork 154
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.15](backport #5346) Improve testing logger #5447
Conversation
* 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) # Conflicts: # internal/pkg/agent/application/upgrade/watcher_test.go # pkg/component/runtime/manager_fake_input_test.go
Cherry-pick of 0126540 has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
This pull request has not been merged yet. Could you please review and merge it @AndersonQ? 🙏 |
This pull request is now in conflicts. Could you fix it? 🙏
|
|
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 logsChecklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files[ ] I have added an entry in./changelog/fragments
using the changelog tool[ ] I have added an integration test or an E2E testDisruptive User Impact
None
How to test this PR locally
run the test
TestObservedLogs_PrettyPrintf
Related issues
Questions to ask yourself
This is an automatic backport of pull request #5346 done by [Mergify](https://mergify.com).