Skip to content

Commit 606df95

Browse files
pmaanencboulay
authored andcommitted
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.
1 parent 2948fb5 commit 606df95

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/api_config.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ void api_config::load_from_file(const std::string &filename) {
105105
} else
106106
loguru::g_stderr_verbosity = log_level;
107107

108+
// log config filename only after setting the verbosity level
109+
if (!filename.empty())
110+
LOG_F(INFO, "Configuration loaded from %s", filename.c_str());
111+
else
112+
LOG_F(INFO, "Loaded default config");
113+
108114
// read out the [ports] parameters
109115
multicast_port_ = pt.get("ports.MulticastPort", 16571);
110116
base_port_ = pt.get("ports.BasePort", 16572);
@@ -263,12 +269,6 @@ void api_config::load_from_file(const std::string &filename) {
263269
smoothing_halftime_ = pt.get("tuning.SmoothingHalftime", 90.0F);
264270
force_default_timestamps_ = pt.get("tuning.ForceDefaultTimestamps", false);
265271

266-
// log config filename only after setting the verbosity level and all config has been read
267-
if (!filename.empty())
268-
LOG_F(INFO, "Configuration loaded from %s", filename.c_str());
269-
else
270-
LOG_F(INFO, "Loaded default config");
271-
272272
} catch (std::exception &e) {
273273
LOG_F(ERROR, "Error parsing config file '%s': '%s', rolling back to defaults",
274274
filename.c_str(), e.what());

0 commit comments

Comments
 (0)