Skip to content

Commit

Permalink
Load log settings before all other settings.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pmaanen authored and cboulay committed Feb 13, 2023
1 parent 8b9ae7c commit 4f32e15
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/api_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 4f32e15

Please sign in to comment.