详细运行测试套件,但排除日志

I am developing a package which uses the log package and logs a variety of things.

I would like to run go test -v ./... on my package and output the list of tests that pass/fail without the logs that are being used. This is helpful to me in the fact that I can get an overview of my entire test suite, without being cluttered by test-specific output.

In the docs for go help testflag, it says:

    -v
        Verbose output: log all tests as they are run. Also print all
        text from Log and Logf calls even if the test succeeds.

Is there a way to separate these two functionalities, and set go test to log all tests as they are run without print(ing) all text from Log and Logf calls even if the test succeeds?

You did not provide an example output, so I cannot give a code answer. But if you are on a Unix machine, you can use go test -v ./... | grep <your_patter_of_interest> to extract output lines with a certain pattern.

A simple example with example output adapted from How to Write Go Code:

Raw Output:

$ go test

ok      github.com/user/stringutil        0.165s
ok      github.com/your/important/package 0.918s
log: passed a certain milestone
log: my code is great!
ok      github.com/another/great/package  0.124s
warning: hey there!

Filtered Output:

$ go test | grep "ok"

ok      github.com/user/stringutil        0.165s
ok      github.com/your/important/package 0.918s
ok      github.com/another/great/package  0.124s