Logging: pass dynamic log level to common functions and subsystems
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 15 Jun 2019 03:59:04 +0000 (23:59 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 20 Jun 2019 18:51:58 +0000 (14:51 -0400)
commitc864e29ae560403106a694438ed75a1e4f20bb33
tree3d7412e7b0b88275d0f785fa4401310cd1a197ed
parent25b57b162787487b0b0c487332f6ded93f00b91e
Logging: pass dynamic log level to common functions and subsystems

This patch makes the project's common functions and subsystems get a
dynamic log level instead of using a global one set from an environment
variable. The goal is to achieve per-component log levels, so the common
functions and subsystems must receive, eventually, the component's
specific log level.

"Naked" functions (without a context object of some sort) simply get
their log level from a new parameter. In that case `BT_LOG_OUTPUT_LEVEL`
is simply defined to `log_level`, so a local `log_level` variable must
exist when using logging statements. Subsystems, such as an FD cache or
a CTF serializer, get their log level from a new parameter in their
initialization function and then use it for their other operations.

It was somehow hard to do this for `src/common` alone without also doing
it for the rest so I'm doing all of them at once here.

For those subsystems, the local `logging.c` and `logging.h` disappear.

`tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c` needs to pass
a log level to the FD cache subsystem; I used the WARN level instead of
setting the log level from an environment variable for this test alone.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I35979a8fe4c74afe5921c3b6651015cd7ee2760a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1460
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
30 files changed:
src/cli/babeltrace2-cfg-cli-args.c
src/cli/babeltrace2.c
src/common/Makefile.am
src/common/common.c
src/common/common.h
src/common/logging.c [deleted file]
src/common/logging.h [deleted file]
src/common/mmap-align.h
src/compat/Makefile.am
src/compat/logging.c [deleted file]
src/compat/logging.h [deleted file]
src/compat/mman.c
src/compat/uuid.c
src/ctf-writer/stream.c
src/ctfser/Makefile.am
src/ctfser/ctfser.c
src/ctfser/ctfser.h
src/ctfser/logging.c [deleted file]
src/ctfser/logging.h [deleted file]
src/fd-cache/Makefile.am
src/fd-cache/fd-cache.c
src/fd-cache/fd-cache.h
src/fd-cache/logging.c [deleted file]
src/fd-cache/logging.h [deleted file]
src/lib/plugin/plugin.c
src/plugins/ctf/fs-sink/fs-sink-stream.c
src/plugins/ctf/fs-src/data-stream-file.c
src/plugins/ctf/fs-src/fs.c
src/plugins/lttng-utils/debug-info/debug-info.c
tests/plugins/flt.lttng-utils.debug-info/test_bin_info.c
This page took 0.030637 seconds and 4 git commands to generate.