From 46b0eb4233fcd0801d7b5acdd22d6400fdfbb0c8 Mon Sep 17 00:00:00 2001 From: xicilion Date: Thu, 25 Mar 2021 20:17:18 +0800 Subject: [PATCH] test, refactor: output error message to stdout. --- fibjs/src/test/test.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fibjs/src/test/test.cpp b/fibjs/src/test/test.cpp index 1c7b1d5bed..eaec106b4d 100644 --- a/fibjs/src/test/test.cpp +++ b/fibjs/src/test/test.cpp @@ -278,8 +278,10 @@ class _case : public obj_base { } coroutine_base::set_loglevel(oldlevel); - asyncLog( - p1->m_error ? console_base::C_ERROR : console_base::C_INFO, str); + if (p1->m_error) + asyncLog(console_base::C_INFO, logger::error() + str + COLOR_RESET); + else + asyncLog(console_base::C_INFO, str); coroutine_base::set_loglevel(loglevel); for (j = (int32_t)stack.size() - 1; j >= 0; j--) { @@ -322,14 +324,14 @@ class _case : public obj_base { } else { sprintf(buf, (logger::error() + " × %d of %d tests failed" + COLOR_RESET + " (%dms)").c_str(), errcnt, cnt, (int32_t)da2.diff(da1)); - asyncLog(console_base::C_ERROR, buf); + asyncLog(console_base::C_INFO, buf); } asyncLog(console_base::C_INFO, ""); for (i = 0; i < (int32_t)msgs.size(); i++) { asyncLog(console_base::C_INFO, names[i]); - asyncLog(console_base::C_ERROR, msgs[i]); + asyncLog(console_base::C_INFO, logger::error() + msgs[i] + COLOR_RESET); } clear();