ULTRAGRID_VERBOSE env var: neutralize if empty

While set, user may want to unset it just for one command, for which the
easiest way is to use `ULTRAGRID_VERBOSE= <cmd>`.
This commit is contained in:
Martin Pulec
2023-04-28 14:32:50 +02:00
parent 64688bb4c7
commit a233123473

View File

@@ -334,7 +334,7 @@ static bool parse_opts_set_logging(int argc, char *argv[])
}
opterr = saved_opterr;
if (logging_lvl == 0) {
logging_lvl = getenv("ULTRAGRID_VERBOSE") != nullptr ? LOG_LEVEL_VERBOSE : log_level;
logging_lvl = getenv("ULTRAGRID_VERBOSE") != nullptr && strlen(getenv("ULTRAGRID_VERBOSE")) > 0 ? LOG_LEVEL_VERBOSE : log_level;
} else {
logging_lvl += LOG_LEVEL_INFO;
}