ocket8888 opened a new pull request, #6882: URL: https://github.com/apache/trafficcontrol/pull/6882
This PR adds the ability to use `(*testing.T).Error` and `(*testing.T).Log` as output streams for the `lib/go-log` library we use for logging. In some of the TO unit tests, if you try to pass in a request and a response recorder and observe the output, you can wind up just getting back the obtuse `Internal Server Error` message with no further visible information. That's annoying to troubleshoot. With this, you just call `InitTestLogging(t, true)` and all of the messages that use e.g. `log.Debugf` will be printed to the test output (at the appropriate level). logged errors mark the test as failed, logged warnings optionally do the same <hr/> ## Which Traffic Control components are affected by this PR? Nothing, this includes no usage, it just seemed big and self-contained enough to be its own PR separate from anything I may be using it for. ## What is the best way to verify this PR? Make sure the tests I wrote have adequate coverage, then make sure they pass. ## PR submission checklist - [x] This PR has tests <!-- If not, please delete this text and explain why this PR does not need tests. --> - [x] This PR has documentation in the form of GoDoc comments - [ ] This PR has a CHANGELOG.md entry - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
