From b5032fb6417a1797c80dc68772cebd298f1154e7 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 9 Sep 2024 11:29:08 +0100 Subject: Fix rawio logs not being written after a rehash. --- src/logging.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/logging.cpp') diff --git a/src/logging.cpp b/src/logging.cpp index da77af131..665939f9b 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -224,6 +224,7 @@ void Log::Manager::OpenLogs(bool requiremethods) { const auto* option = ServerInstance->Config->CommandLine.forceprotodebug ? "--protocoldebug" : "--debug"; Normal("LOG", "Not opening loggers because we were started with {}", option); + CheckRawLog(); return; } @@ -231,6 +232,7 @@ void Log::Manager::OpenLogs(bool requiremethods) if (!ServerInstance->Config->CommandLine.writelog) { Normal("LOG", "Not opening loggers because we were started with --nolog"); + CheckRawLog(); return; } @@ -295,11 +297,7 @@ void Log::Manager::OpenLogs(bool requiremethods) cache.shrink_to_fit(); caching = false; } - - // There might be a logger not from the config so we need to check this outside of the creation loop. - ServerInstance->Config->RawLog = std::any_of(loggers.begin(), loggers.end(), [](const auto& logger) { - return logger.level >= Level::RAWIO; - }); + CheckRawLog(); } void Log::Manager::RegisterServices() @@ -318,6 +316,14 @@ void Log::Manager::UnloadEngine(const Engine* engine) Normal("LOG", "The {} log engine is unloading; removed {}/{} loggers.", engine->name.c_str(), logger_count - loggers.size(), logger_count); } +void Log::Manager::CheckRawLog() +{ + // There might be a logger not from the config so we need to check this outside of the creation loop. + ServerInstance->Config->RawLog = std::any_of(loggers.begin(), loggers.end(), [](const auto& logger) { + return logger.level >= Level::RAWIO; + }); +} + void Log::Manager::Write(Level level, const std::string& type, const std::string& message) { if (logging) -- cgit v1.3.1-10-gc9f91