diff --git a/src/dll/Utils.cpp b/src/dll/Utils.cpp index 59de31b3..193f695e 100644 --- a/src/dll/Utils.cpp +++ b/src/dll/Utils.cpp @@ -13,6 +13,18 @@ std::shared_ptr Utils::CreateLogger(const std::wstring_view aLog const Paths& aPaths, const Config& aConfig, const DevConsole& aDevConsole) { + const auto& loggingConfig = aConfig.GetLogging(); + + if (loggingConfig.level == spdlog::level::level_enum::off) + { + std::vector sinks; + auto logger = std::make_shared("dummy_logger", begin(sinks), end(sinks)); + logger->set_level(spdlog::level::level_enum::off); + logger->flush_on(loggingConfig.flushOn); + + return logger; + } + try { auto dir = aPaths.GetLogsDir(); @@ -53,7 +65,6 @@ std::shared_ptr Utils::CreateLogger(const std::wstring_view aLog constexpr auto oneKbInB = 1024 * oneByte; constexpr auto oneMbInB = 1024 * oneKbInB; - const auto& loggingConfig = aConfig.GetLogging(); const size_t maxFiles = loggingConfig.maxFiles; const size_t maxFileSize = static_cast(loggingConfig.maxFileSize) * oneMbInB;