From 9f6211ea1c38e5837c797134202ce2adb9152644 Mon Sep 17 00:00:00 2001 From: Paul Maanen Date: Tue, 16 Aug 2022 15:35:24 +0200 Subject: [PATCH] Load log settings before all other settings. Loading the log settings last causes heaps of INFO messages to be displayed by lsl::get_local_interfaces() even if the user has set log level to -3. Changing the order causes less ui clutter and respects the users choices. --- src/api_config.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api_config.cpp b/src/api_config.cpp index 7c7635ee..f0f93405 100644 --- a/src/api_config.cpp +++ b/src/api_config.cpp @@ -105,6 +105,12 @@ void api_config::load_from_file(const std::string &filename) { } else loguru::g_stderr_verbosity = log_level; + // log config filename only after setting the verbosity level + if (!filename.empty()) + LOG_F(INFO, "Configuration loaded from %s", filename.c_str()); + else + LOG_F(INFO, "Loaded default config"); + // read out the [ports] parameters multicast_port_ = pt.get("ports.MulticastPort", 16571); base_port_ = pt.get("ports.BasePort", 16572); @@ -263,12 +269,6 @@ void api_config::load_from_file(const std::string &filename) { smoothing_halftime_ = pt.get("tuning.SmoothingHalftime", 90.0F); force_default_timestamps_ = pt.get("tuning.ForceDefaultTimestamps", false); - // log config filename only after setting the verbosity level and all config has been read - if (!filename.empty()) - LOG_F(INFO, "Configuration loaded from %s", filename.c_str()); - else - LOG_F(INFO, "Loaded default config"); - } catch (std::exception &e) { LOG_F(ERROR, "Error parsing config file '%s': '%s', rolling back to defaults", filename.c_str(), e.what());