mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
@ -100,18 +100,33 @@ LogManager::LogManager()
|
||||
IniFile::Section* options = ini.GetOrCreateSection("Options");
|
||||
bool write_file;
|
||||
bool write_console;
|
||||
bool write_window;
|
||||
options->Get("WriteToFile", &write_file, false);
|
||||
options->Get("WriteToConsole", &write_console, true);
|
||||
options->Get("WriteToWindow", &write_window, true);
|
||||
|
||||
// Set up log listeners
|
||||
int verbosity;
|
||||
options->Get("Verbosity", &verbosity, 0);
|
||||
|
||||
// Ensure the verbosity level is valid
|
||||
if (verbosity < 1)
|
||||
verbosity = 1;
|
||||
if (verbosity > MAX_LOGLEVEL)
|
||||
verbosity = MAX_LOGLEVEL;
|
||||
|
||||
for (LogContainer* container : m_Log)
|
||||
{
|
||||
bool enable;
|
||||
logs->Get(container->GetShortName(), &enable, false);
|
||||
container->SetEnable(enable);
|
||||
container->SetLevel(static_cast<LogTypes::LOG_LEVELS>(verbosity));
|
||||
if (enable && write_file)
|
||||
container->AddListener(LogListener::FILE_LISTENER);
|
||||
if (enable && write_console)
|
||||
container->AddListener(LogListener::CONSOLE_LISTENER);
|
||||
if (enable && write_window)
|
||||
container->AddListener(LogListener::LOG_WINDOW_LISTENER);
|
||||
}
|
||||
|
||||
m_path_cutoff_point = DeterminePathCutOffPoint();
|
||||
@ -149,7 +164,8 @@ void LogManager::LogWithFullPath(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE
|
||||
LogTypes::LOG_LEVEL_TO_CHAR[(int)level], log->GetShortName().c_str(), temp);
|
||||
|
||||
for (auto listener_id : *log)
|
||||
m_listeners[listener_id]->Log(level, msg.c_str());
|
||||
if (m_listeners[listener_id])
|
||||
m_listeners[listener_id]->Log(level, msg.c_str());
|
||||
}
|
||||
|
||||
void LogManager::Init()
|
||||
|
@ -86,7 +86,7 @@ class LogManager : NonCopyable
|
||||
private:
|
||||
LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS];
|
||||
static LogManager* m_logManager; // Singleton. Ugh.
|
||||
std::array<LogListener*, LogListener::NUMBER_OF_LISTENERS> m_listeners;
|
||||
std::array<LogListener*, LogListener::NUMBER_OF_LISTENERS> m_listeners{};
|
||||
size_t m_path_cutoff_point = 0;
|
||||
|
||||
LogManager();
|
||||
|
Reference in New Issue
Block a user