Skip to content

Commit 0a4a80f

Browse files
authored
Fix severity level of gzlog (#635)
The severity level of `gzlog` was incorrectly set to `err`. Changing this to `trace` solves two problems: 1. The log message is now a lot less alarming 2. When running `gz sim -v4`, this message is not shown on the console. It will only be logged to file. It does show up on the console if you run with `-v5`. The second point is technically a behavior change since in Harmonic, regardless of the verbosity level, `gzlog` would never show up on the console. However, duplicating that behavior with the new Console implementation proved to be very complicated. So, I propose we change the meaning of `gzlog` to be equivalent to `gztrace`. Signed-off-by: Addisu Z. Taddese <[email protected]>
1 parent bbb3183 commit 0a4a80f

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

graphics/src/ColladaLoader_TEST.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ TEST_F(ColladaLoader, LoadZeroCount)
112112
common::testing::TestFile("data", "zero_count.dae"));
113113
ASSERT_TRUE(mesh);
114114
#ifndef _WIN32
115+
common::Console::Root().RawLogger().flush();
115116
std::string log = LogContent();
116117

117118
// Expect no errors about missing values

include/gz/common/Console.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace gz
7777

7878
/// \brief Output a message to a log file.
7979
#define gzlog gz::common::LogMessage( \
80-
__FILE__, __LINE__, spdlog::level::err).stream()
80+
__FILE__, __LINE__, spdlog::level::trace).stream()
8181

8282
/// \brief Output a message.
8383
#define gzmsg gz::common::LogMessage( \

src/Console_TEST.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ TEST_F(Console_TEST, NoInitAndLog)
8282
// Get the absolute log file path
8383
std::string logPath = ".gz/auto_default.log";
8484

85+
common::Console::Root().RawLogger().flush();
8586
// Expect to find the string in the log file
8687
EXPECT_TRUE(GetLogContent(logPath).find(logString) != std::string::npos);
8788

@@ -118,6 +119,7 @@ TEST_F(Console_TEST, InitAndLog)
118119
// Get the absolute log file path
119120
std::string logPath = common::joinPaths(path, "test.log");
120121

122+
common::Console::Root().RawLogger().flush();
121123
// Expect to find the string in the log file
122124
EXPECT_TRUE(GetLogContent(logPath).find(logString) != std::string::npos);
123125

@@ -149,6 +151,7 @@ TEST_F(Console_TEST, LogSlashN)
149151
gzlog << logString << " _n__ " << i << '\n';
150152
}
151153

154+
common::Console::Root().RawLogger().flush();
152155
std::string logContent = GetLogContent(logPath);
153156

154157
for (int i = 0; i < g_messageRepeat; ++i)
@@ -179,6 +182,7 @@ TEST_F(Console_TEST, LogStdEndl)
179182
gzlog << logString << " endl " << i << std::endl;
180183
}
181184

185+
common::Console::Root().RawLogger().flush();
182186
std::string logContent = GetLogContent(logPath);
183187

184188
for (int i = 0; i < g_messageRepeat; ++i)

0 commit comments

Comments
 (0)