如何仅通过失败的测试而不是失败的软件包打印stdout / stderr?

If a single test fails, the entire package fails and thus the output from all tests within that package are printed. This is cumbersome since the functions being tested have logging in them. I could suppress the logging entirely but that makes it difficult to track down the root when a test fails because my log output has a ton of extra noise.

Is it possible to only print the output from a specific test that fails, instead of printing the entire package?

The first solution that comes to mind is to wrap each test in a function which redirects the log output to a buffer, and then only print the buffer if the test it's wrapping fails, but that obviously adds extra boilerplate to my tests that I'd rather not have to add.