Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/dll/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ std::shared_ptr<spdlog::logger> 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<spdlog::sink_ptr> sinks;
auto logger = std::make_shared<spdlog::logger>("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();
Expand Down Expand Up @@ -53,7 +65,6 @@ std::shared_ptr<spdlog::logger> 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<size_t>(loggingConfig.maxFileSize) * oneMbInB;

Expand Down