summaryrefslogtreecommitdiffstats
path: root/modules/testlogger
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-05-12 22:20:29 +0800
committerGitHub <noreply@github.com>2023-05-12 14:20:29 +0000
commitbfa0fc2c989b662cea2f171ae345b0d4e358fdf1 (patch)
tree28ebed9e647eb11cf6824e671b2da8f45517155d /modules/testlogger
parenta7773d28d22988f67ca391ded3b35093bfa49d76 (diff)
downloadgitea-bfa0fc2c989b662cea2f171ae345b0d4e358fdf1.tar.gz
gitea-bfa0fc2c989b662cea2f171ae345b0d4e358fdf1.zip
Make testlogger output "TestLogger" prefix (#24683)
Make testlogger output "TestLogger" prefix instead of "Unknown Test" when there is no running test case.
Diffstat (limited to 'modules/testlogger')
-rw-r--r--modules/testlogger/testlogger.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/testlogger/testlogger.go b/modules/testlogger/testlogger.go
index bf912f41dc..cc80e86c81 100644
--- a/modules/testlogger/testlogger.go
+++ b/modules/testlogger/testlogger.go
@@ -58,7 +58,9 @@ func (w *testLoggerWriterCloser) Write(p []byte) (int, error) {
}
if t == nil || *t == nil {
- return fmt.Fprintf(os.Stdout, "??? [Unknown Test] %s\n", p)
+ // if there is no running test, the log message should be outputted to console, to avoid losing important information.
+ // the "???" prefix is used to match the "===" and "+++" in PrintCurrentTest
+ return fmt.Fprintf(os.Stdout, "??? [TestLogger] %s\n", p)
}
defer func() {