cli: add global --log-level option
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 14 Jun 2017 05:17:23 +0000 (01:17 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 14 Jun 2017 19:17:45 +0000 (15:17 -0400)
commit3efa30527e93de6e2374c47ed9dfb633508e123b
treecfeb4349517ccf9b5aaba1ff33eb4fbb3f0df9a9
parent62128320f132f643c5d43fce0220531143614180
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>
cli/babeltrace-cfg-cli-args.c
cli/babeltrace-cfg.h
cli/babeltrace.c
This page took 0.026162 seconds and 4 git commands to generate.