logging-internal.h: add BT_LOG_LEVEL_EXTERN_SYMBOL(), BT_LOG_INIT_LOG_LEVEL()
BT_LOG_INIT_LOG_LEVEL() defines a hidden log level symbol and a static
constructor which initializes this symbol according to the value of
a given environment variable. This macro should be used in a module-wise
dedicated logging source file, `logging.c`, as such:
#define BT_LOG_OUTPUT_LEVEL some_log_level_symbol
#include <babeltrace/logging-internal.h>
BT_LOG_INIT_LOG_LEVEL(some_log_level_symbol, "BABELTRACE_SOME_LOG_LEVEL");
BT_LOG_LEVEL_EXTERN_SYMBOL() declares this symbol as `extern`. It
should be used in a module-wise dedicated logging header, `logging.h`,
as such:
#define BT_LOG_OUTPUT_LEVEL some_log_level_symbol
#include <babeltrace/logging-internal.h>
BT_LOG_LEVEL_EXTERN_SYMBOL(some_log_level_symbol);
Any module source file which contains log statements should use the
following lines **before any #include line**:
#define BT_LOG_TAG "THE-MODULE-TAG"
#include "logging.h"
If there are subdirectories within a module, it is possible that you
need to include "../logging.h" or "../../logging.h", for example. The
rule of thumb is that no module file, except `logging.c`, should include
<babeltrace/logging-internal.h> directly.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.035797 seconds and 4 git commands to generate.