cli: add global --log-level option
This new global option (applies before the command name) sets the
default log level of all the known (project's) loggers. This default
log level can still be overridden by a specific environment variable,
for example:
BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL=D babeltrace --log-level=I ...
In this example, all the log levels are set to INFO, but
BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL overrides the `ctf` plugin's
metadata module's log level to DEBUG.
When you don't specify --log-level, it defaults to W (WARN), the current
behaviour.
--verbose is now the equivalent of --log-level=I, and --debug is the
equivalent of --log-level=V. --verbose and --debug do the same thing,
for the `convert` command, whether they are global or specific to the
command. --verbose and --debug can still be specified together, and
whatever the order, the lowest log level always wins: VERBOSE.
The --log-level option can override previous --verbose, --debug, or
--log-level options because it didn't exist in Babeltrace 1 anyway so
there's no way to break backward compatibility:
babeltrace --log-level=W --verbose --log-level=E ...
In this case, the final log level is ERROR.
Other example with implicit `convert` command:
babeltrace --log-level=E /path/to/trace -v
In this case, the command's --verbose option sets the log level to
INFO because it's lower than ERROR (set by --log-level=E).
One of the main use cases of the new --log-level option is to completely
disable logging:
babeltrace --log-level=N ...
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.025882 seconds and 4 git commands to generate.