Skip to content

Commit

Permalink
QOL: Set Log Filter On Save (shadps4-emu#991)
Browse files Browse the repository at this point in the history
* set log filter on reset

* clang format
  • Loading branch information
ElBread3 authored Sep 20, 2024
1 parent 079d902 commit 077f898
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/common/logging/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ class Impl {
initialization_in_progress_suppress_logging = false;
}

static bool IsActive() {
return instance != nullptr;
}

static void Start() {
instance->StartBackendThread();
}
Expand Down Expand Up @@ -275,6 +279,10 @@ void Initialize(std::string_view log_file) {
Impl::Initialize(log_file.empty() ? LOG_FILE : log_file);
}

bool IsActive() {
return Impl::IsActive();
}

void Start() {
Impl::Start();
}
Expand Down
2 changes: 2 additions & 0 deletions src/common/logging/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class Filter;
/// Initializes the logging system. This should be the first thing called in main.
void Initialize(std::string_view log_file = "");

bool IsActive();

/// Starts the logging threads.
void Start();

Expand Down
7 changes: 7 additions & 0 deletions src/qt_gui/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <QCompleter>
#include <QDirIterator>

#include "common/logging/backend.h"
#include "common/logging/filter.h"
#include "main_window.h"
#include "settings_dialog.h"
#include "ui_settings_dialog.h"
Expand Down Expand Up @@ -78,6 +80,11 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices, QWidge
Config::setDefaultValues();
LoadValuesFromConfig();
}
if (Common::Log::IsActive()) {
Common::Log::Filter filter;
filter.ParseFilterString(Config::getLogFilter());
Common::Log::SetGlobalFilter(filter);
}
});

ui->buttonBox->button(QDialogButtonBox::Save)->setText(tr("Save"));
Expand Down

0 comments on commit 077f898

Please sign in to comment.