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 22:09:41 +0000 (18:09 -0400)
commit9e503aa9214de016a83d1ce571f3a82b0d588a0c
tree069afea6b8af15a5957551137291a7d68acd0467
parent6ae2164fb8658b3b2edf3964c60e8eee12bd6d52
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.027113 seconds and 4 git commands to generate.