Merge pull request #6199 from lioncash/log-ns

common/log: Move Log namespace into the Common namespace
This commit is contained in:
bunnei
2021-04-14 21:29:44 -07:00
committed by GitHub
11 changed files with 58 additions and 45 deletions

View File

@ -55,9 +55,9 @@ void ConfigureDebug::ApplyConfiguration() {
Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked();
Settings::values.extended_logging = ui->extended_logging->isChecked();
Debugger::ToggleConsole();
Log::Filter filter;
Common::Log::Filter filter;
filter.ParseFilterString(Settings::values.log_filter);
Log::SetGlobalFilter(filter);
Common::Log::SetGlobalFilter(filter);
}
void ConfigureDebug::changeEvent(QEvent* event) {

View File

@ -29,13 +29,13 @@ void ToggleConsole() {
freopen_s(&temp, "CONIN$", "r", stdin);
freopen_s(&temp, "CONOUT$", "w", stdout);
freopen_s(&temp, "CONOUT$", "w", stderr);
Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
Common::Log::AddBackend(std::make_unique<Common::Log::ColorConsoleBackend>());
}
} else {
if (FreeConsole()) {
// In order to close the console, we have to also detach the streams on it.
// Just redirect them to NUL if there is no console window
Log::RemoveBackend(Log::ColorConsoleBackend::Name());
Common::Log::RemoveBackend(Common::Log::ColorConsoleBackend::Name());
freopen_s(&temp, "NUL", "r", stdin);
freopen_s(&temp, "NUL", "w", stdout);
freopen_s(&temp, "NUL", "w", stderr);
@ -43,9 +43,9 @@ void ToggleConsole() {
}
#else
if (UISettings::values.show_console) {
Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
Common::Log::AddBackend(std::make_unique<Common::Log::ColorConsoleBackend>());
} else {
Log::RemoveBackend(Log::ColorConsoleBackend::Name());
Common::Log::RemoveBackend(Common::Log::ColorConsoleBackend::Name());
}
#endif
}

View File

@ -171,12 +171,14 @@ void GMainWindow::ShowTelemetryCallout() {
const int GMainWindow::max_recent_files_item;
static void InitializeLogging() {
using namespace Common;
Log::Filter log_filter;
log_filter.ParseFilterString(Settings::values.log_filter);
Log::SetGlobalFilter(log_filter);
const std::string& log_dir = Common::FS::GetUserPath(Common::FS::UserPath::LogDir);
Common::FS::CreateFullPath(log_dir);
const std::string& log_dir = FS::GetUserPath(FS::UserPath::LogDir);
FS::CreateFullPath(log_dir);
Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE));
#ifdef _WIN32
Log::AddBackend(std::make_unique<Log::DebuggerBackend>());