proposal: testing: provide a way to log a line without a source location #23747
Labels
Milestone
Comments
For the same reason, I often wanted a io.Writer bound to the test output (and had to implement a bad one on top of T.Log). Sounds like that might be a better solution because it also avoids spurious newlines, and plugs right into log.SetOutput. |
I understand your point but in this case it seems like the best choice is to print another file:line after with what you want to indicate. New API for this doesn't seem warranted. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There's no way to log a line without also including source information of a caller of Log.
When hooking logger implementations up *testing.T so that log messages can be directly associated with a test (particularly important when running parallel tests), the source line is almost always noise, as one of the callers of t.Log will be a function in the logging package, which cannot call Helper. Also the logger
implementation will usually be in a position to add its own annotation.
Unnecessary noise can often be a significant barrier to quick comprehension of test output.
We propose that a new method be added to *testing.T, *testing.B and testing.TB:
The text was updated successfully, but these errors were encountered: