add filter options

This commit is contained in:
lizzie 2026-06-10 00:35:39 +00:00
parent 713b5f6bed
commit d004c688c2
4 changed files with 40 additions and 45 deletions

View file

@ -220,6 +220,7 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
std::string password{};
std::string address{};
std::string input_profile{};
std::optional<std::string> log_filter{};
u16 port = Network::DefaultRoomPort;
static struct option long_options[] = {
@ -235,6 +236,7 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
{"version", no_argument, 0, 'v'},
{"input-profile", no_argument, 0, 'i'},
{"null-render", no_argument, 0, 'n'},
{"filter", no_argument, 0, 'F'},
{0, 0, 0, 0},
// clang-format on
};
@ -308,6 +310,10 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
case 'n':
force_null_render = true;
break;
case 'F':
log_filter = argv[optind];
++optind;
break;
}
} else {
#ifdef _WIN32
@ -324,7 +330,7 @@ extern "C" SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
// apply the log_filter setting
// the logger was initialized before and doesn't pick up the filter on its own
Common::Log::Filter filter;
filter.ParseFilterString(Settings::values.log_filter.GetValue());
filter.ParseFilterString(log_filter.value_or(Settings::values.log_filter.GetValue()));
Common::Log::SetGlobalFilter(filter);
if (!program_args.empty()) {