From a9bc710a7322e78b924bd9dea381aa524f949601 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 16 Aug 2022 15:11:27 +0200 Subject: [PATCH] respect ULTRAGRID_VEBOSE environment variable Previously it was errorneously checked while setting log level from the command-line opt. If no was given, the particular function was not run. --- src/debug.cpp | 4 ---- src/host.cpp | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index a26f58d46..f113a1c23 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -244,10 +244,6 @@ bool parse_log_cfg(const char *conf_str, *show_timestamps = LOG_TIMESTAMP_DISABLED; } - if (getenv("ULTRAGRID_VERBOSE") != nullptr) { - *log_lvl = LOG_LEVEL_VERBOSE; - } - if (cfg.empty() || cfg[0] == '+' || cfg[0] == '-') { // only flags, no log level return true; } diff --git a/src/host.cpp b/src/host.cpp index 04d32d1ce..acdaf6a5e 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -304,8 +304,9 @@ static bool parse_opts_set_logging(int argc, char *argv[]) // of argv arguments - we do not have the whole option set in optstring, so it // would put optargs to the end ("uv -t testcard -V" -> "uv -t -V testcard") - int logging_lvl = LOG_LEVEL_INFO; + int logging_lvl = getenv("ULTRAGRID_VERBOSE") != nullptr ? LOG_LEVEL_VERBOSE : LOG_LEVEL_INFO; bool logger_skip_repeats = true; + log_timestamp_mode logger_show_timestamps = LOG_TIMESTAMP_AUTO; for (int i = 1; i < argc; ++i) {