Skip to content

Commit bfa0fc2

Browse files
authored
Make testlogger output "TestLogger" prefix (#24683)
Make testlogger output "TestLogger" prefix instead of "Unknown Test" when there is no running test case.
1 parent a7773d2 commit bfa0fc2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/testlogger/testlogger.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ func (w *testLoggerWriterCloser) Write(p []byte) (int, error) {
5858
}
5959

6060
if t == nil || *t == nil {
61-
return fmt.Fprintf(os.Stdout, "??? [Unknown Test] %s\n", p)
61+
// if there is no running test, the log message should be outputted to console, to avoid losing important information.
62+
// the "???" prefix is used to match the "===" and "+++" in PrintCurrentTest
63+
return fmt.Fprintf(os.Stdout, "??? [TestLogger] %s\n", p)
6264
}
6365

6466
defer func() {

0 commit comments

Comments
 (0)