lib/object.h: log conditionally to `BT_OBJECT_DONT_LOG` undefined
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 18 Jun 2019 04:01:25 +0000 (00:01 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 20 Jun 2019 18:51:59 +0000 (14:51 -0400)
commit829b36946213ba1529f9c4c417b6a5aa0b6e3d90
tree14a0d03ed976c8cd51dc3b2c5ad62dbad3e46e2d
parent1a4e73838b7aa65ddf0315b6d0684cb5c606d66f
lib/object.h: log conditionally to `BT_OBJECT_DONT_LOG` undefined

There are a few places within the project, but outside the library, that
for historic reasons use the library's internal `bt_object` API to have
reference counting. The `bt_object` API belongs to the library for the
moment and should not be included as such.

There's an issue when you need logging in your module and the functions
which log within `object.h` cannot make sense of the
`BT_LOG_OUTPUT_LEVEL` expression. To avoid this and save short-term
development time, make them not log if `BT_OBJECT_DONT_LOG` is defined.
Then, outside the library, you can do something like:

    #define BT_LOG_OUTPUT_LEVEL my_log_level
    #define BT_LOG_TAG MY-TAG
    #include "logging/log.h"

    #define BT_OBJECT_DONT_LOG
    #include "lib/object.h"

Another solution would be to include `lib/logging.h` before
`logging/log.h`, but that's not always easy.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If3037b67e5c4f87f57db96528d0a9516c8f9d6ea
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1493
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/lib/object.h
This page took 0.024737 seconds and 4 git commands to generate.