From cd01d25deb5d512bf0ef0cda73b169564c7d6f8a Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 5 Sep 2024 17:56:49 -0500 Subject: [PATCH 1/2] Fix severity level of gzlog Signed-off-by: Addisu Z. Taddese --- include/gz/common/Console.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/gz/common/Console.hh b/include/gz/common/Console.hh index a188de20..b20dffec 100644 --- a/include/gz/common/Console.hh +++ b/include/gz/common/Console.hh @@ -77,7 +77,7 @@ namespace gz /// \brief Output a message to a log file. #define gzlog gz::common::LogMessage( \ - __FILE__, __LINE__, spdlog::level::err).stream() + __FILE__, __LINE__, spdlog::level::trace).stream() /// \brief Output a message. #define gzmsg gz::common::LogMessage( \ From 0bd84835e8982a747cff2da43efc1b71a24882e2 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 5 Sep 2024 23:31:04 -0500 Subject: [PATCH 2/2] Add flush call to fix gzlog tests Signed-off-by: Addisu Z. Taddese --- graphics/src/ColladaLoader_TEST.cc | 1 + src/Console_TEST.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/graphics/src/ColladaLoader_TEST.cc b/graphics/src/ColladaLoader_TEST.cc index 754f913d..3634b172 100644 --- a/graphics/src/ColladaLoader_TEST.cc +++ b/graphics/src/ColladaLoader_TEST.cc @@ -112,6 +112,7 @@ TEST_F(ColladaLoader, LoadZeroCount) common::testing::TestFile("data", "zero_count.dae")); ASSERT_TRUE(mesh); #ifndef _WIN32 + common::Console::Root().RawLogger().flush(); std::string log = LogContent(); // Expect no errors about missing values diff --git a/src/Console_TEST.cc b/src/Console_TEST.cc index 97d65c32..5c31b9ce 100644 --- a/src/Console_TEST.cc +++ b/src/Console_TEST.cc @@ -82,6 +82,7 @@ TEST_F(Console_TEST, NoInitAndLog) // Get the absolute log file path std::string logPath = ".gz/auto_default.log"; + common::Console::Root().RawLogger().flush(); // Expect to find the string in the log file EXPECT_TRUE(GetLogContent(logPath).find(logString) != std::string::npos); @@ -118,6 +119,7 @@ TEST_F(Console_TEST, InitAndLog) // Get the absolute log file path std::string logPath = common::joinPaths(path, "test.log"); + common::Console::Root().RawLogger().flush(); // Expect to find the string in the log file EXPECT_TRUE(GetLogContent(logPath).find(logString) != std::string::npos); @@ -149,6 +151,7 @@ TEST_F(Console_TEST, LogSlashN) gzlog << logString << " _n__ " << i << '\n'; } + common::Console::Root().RawLogger().flush(); std::string logContent = GetLogContent(logPath); for (int i = 0; i < g_messageRepeat; ++i) @@ -179,6 +182,7 @@ TEST_F(Console_TEST, LogStdEndl) gzlog << logString << " endl " << i << std::endl; } + common::Console::Root().RawLogger().flush(); std::string logContent = GetLogContent(logPath); for (int i = 0; i < g_messageRepeat; ++i)