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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 20 Jun 2019 18:01:16 +0000 (14:01 -0400)
commit9358ceb38baa2d50a69d7ee580463a2ddba25465
tree91cebbea79c42473094f7e0453ee80a01bfa6be3
parent70f5364a8b13c524d879b3e8d98ccf5cf673af6c
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.024616 seconds and 4 git commands to generate.