lib: use BT_LIB_LOG*_APPEND_CAUSE() where appropriate
[babeltrace.git] / src / lib / trace-ir / event.h
index 308c451e65b550b4305ce72d5a34ff38c1224925..002278ce88e1bb090e2e3e01ae6d23f9166f7b18 100644 (file)
  */
 
 /* Protection: this file uses BT_LIB_LOG*() macros directly */
-#ifndef BABELTRACE_LIB_LOGGING_INTERNAL_H
-# error Please include <lib/lib-logging.h> before including this file.
+#ifndef BT_LIB_LOG_SUPPORTED
+# error Please include "lib/logging.h" before including this file.
 #endif
 
 #include "lib/assert-pre.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/value.h>
 #include <babeltrace2/trace-ir/stream-class.h>
 #include <babeltrace2/trace-ir/stream.h>
@@ -80,7 +80,7 @@ void _bt_event_set_is_frozen(const struct bt_event *event, bool is_frozen);
 # define bt_event_set_is_frozen(_event, _is_frozen)
 #endif
 
-BT_UNUSED
+__attribute__((unused))
 static inline
 void _bt_event_reset_dev_mode(struct bt_event *event)
 {
@@ -174,7 +174,7 @@ void bt_event_set_packet(struct bt_event *event, struct bt_packet *packet)
        BT_ASSERT(!event->packet);
        event->packet = packet;
        bt_object_get_no_null_check_no_parent_check(&event->packet->base);
-       BT_LIB_LOGV("Set event's packet: %![event-]+e, %![packet-]+a",
+       BT_LIB_LOGD("Set event's packet: %![event-]+e, %![packet-]+a",
                event, packet);
 }
 
@@ -186,13 +186,14 @@ struct bt_event *bt_event_create(struct bt_event_class *event_class,
 
        BT_ASSERT(event_class);
        event = bt_object_pool_create_object(&event_class->event_pool);
-       if (unlikely(!event)) {
-               BT_LIB_LOGE("Cannot allocate one event from event class's event pool: "
+       if (G_UNLIKELY(!event)) {
+               BT_LIB_LOGE_APPEND_CAUSE(
+                       "Cannot allocate one event from event class's event pool: "
                        "%![ec-]+E", event_class);
                goto end;
        }
 
-       if (likely(!event->class)) {
+       if (G_LIKELY(!event->class)) {
                event->class = event_class;
                bt_object_get_no_null_check(&event_class->base);
        }
This page took 0.024423 seconds and 4 git commands to generate.