Log: Switch to enum class

Need to change the channel to a bitset too.. the string lookups are
horribly slow, and conflict when one is a prefix of another.
This commit is contained in:
Stenzek
2024-09-21 21:49:38 +10:00
parent 88381209b3
commit 3dca598063
146 changed files with 291 additions and 291 deletions

View File

@ -25,7 +25,7 @@
#include <cctype>
#include <numeric>
Log_SetChannel(Settings);
LOG_CHANNEL(Settings);
Settings g_settings;
@ -906,13 +906,13 @@ static constexpr const std::array s_log_level_display_names = {
TRANSLATE_DISAMBIG_NOOP("Settings", "Trace", "LogLevel"),
};
std::optional<LOGLEVEL> Settings::ParseLogLevelName(const char* str)
std::optional<Log::Level> Settings::ParseLogLevelName(const char* str)
{
int index = 0;
for (const char* name : s_log_level_names)
{
if (StringUtil::Strcasecmp(name, str) == 0)
return static_cast<LOGLEVEL>(index);
return static_cast<Log::Level>(index);
index++;
}
@ -920,12 +920,12 @@ std::optional<LOGLEVEL> Settings::ParseLogLevelName(const char* str)
return std::nullopt;
}
const char* Settings::GetLogLevelName(LOGLEVEL level)
const char* Settings::GetLogLevelName(Log::Level level)
{
return s_log_level_names[static_cast<size_t>(level)];
}
const char* Settings::GetLogLevelDisplayName(LOGLEVEL level)
const char* Settings::GetLogLevelDisplayName(Log::Level level)
{
return Host::TranslateToCString("Settings", s_log_level_display_names[static_cast<size_t>(level)], "LogLevel");
}