Skip to content

Commit 720a266

Browse files
committed
Replace C4Game::Verbose with C4LogSystem::SetVerbose
1 parent 78a7a89 commit 720a266

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/C4Game.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,6 @@ void C4Game::Default()
17481748
Parameters.ScenarioTitle.Ref("Loading...");
17491749
HaltCount = 0;
17501750
Evaluated = false;
1751-
Verbose = false;
17521751
TimeGo = false;
17531752
Time = 0;
17541753
StartTime = 0;
@@ -3272,7 +3271,7 @@ void C4Game::ParseCommandLine(const char *szCmdLine)
32723271

32733272
// verbose
32743273
if (SSearchNoCase(szCmdLine, "/verbose"))
3275-
Verbose = true;
3274+
Application.LogSystem.SetVerbose(true);
32763275

32773276
// startup dialog required?
32783277
Application.UseStartupDialog = Application.isFullScreen && !*DirectJoinAddress && !*ScenarioFilename && !RecordStream.getSize();

src/C4Game.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ class C4Game
153153
int32_t iLobbyTimeout;
154154
bool fObserve;
155155
bool NetworkActive;
156-
bool Verbose; // default false; set to true only by command line
157156
StdStrBuf RecordDumpFile;
158157
StdStrBuf RecordStream;
159158
bool TempScenarioFile;

src/C4Log.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,7 @@ C4LogSystem::C4LogSystem()
241241
{
242242
spdlog::set_automatic_registration(false);
243243

244-
const auto logLevel = Game.Verbose ? spdlog::level::debug : spdlog::level::warn;
245-
246-
loggerSilentGuiSink = std::make_shared<GuiSink>(logLevel, true);
244+
loggerSilentGuiSink = std::make_shared<GuiSink>(spdlog::level::warn, true);
247245

248246
#ifdef _WIN32
249247
debugSink = std::make_shared<spdlog::sinks::msvc_sink_mt>();
@@ -273,7 +271,7 @@ C4LogSystem::C4LogSystem()
273271
void C4LogSystem::OpenLog()
274272
{
275273
stdoutSink = std::static_pointer_cast<spdlog::sinks::sink>(std::make_shared<spdlog::sinks::stdout_color_sink_mt>());
276-
stdoutSink->set_level(Game.Verbose ? spdlog::level::debug : spdlog::level::info);
274+
stdoutSink->set_level(spdlog::level::info);
277275

278276
clonkLogSink = std::make_shared<LogSink>();
279277
clonkLogFD = clonkLogSink->GetFD();
@@ -338,6 +336,12 @@ void C4LogSystem::EnableDebugLog(const bool enable)
338336
loggerDebugGuiSink->set_level(enable ? spdlog::level::debug : spdlog::level::off);
339337
}
340338

339+
void C4LogSystem::SetVerbose(const bool verbose)
340+
{
341+
loggerSilentGuiSink->set_level(verbose ? spdlog::level::trace : spdlog::level::warn);
342+
stdoutSink->set_level(verbose ? spdlog::level::trace : spdlog::level::info);
343+
}
344+
341345
void C4LogSystem::AddFatalError(std::string message)
342346
{
343347
logger->critical("{}", LoadResStr(C4ResStrTableKey::IDS_ERR_FATAL, message));

src/C4Log.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class C4LogSystem
124124
std::shared_ptr<spdlog::logger> GetOrCreate(std::string name, C4LogSystemCreateLoggerOptions options = {});
125125

126126
void EnableDebugLog(bool enable);
127+
void SetVerbose(bool verbose);
127128

128129
private:
129130
std::shared_ptr<spdlog::logger> logger;

0 commit comments

Comments
 (0)