lib/ctf-ir/event.c: logging: fix log levels and more verbose/debug logging
[babeltrace.git] / lib / ctf-ir / event.c
index 59eac156596fabe61dc703b37b41488eb9c4d780..005173e6c621da6bd771dbfbacff95e300650cfe 100644 (file)
@@ -94,11 +94,7 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class)
         * associated to a stream class.
         */
        if (!stream_class) {
-               BT_LOGW("Event class is not part of a stream class: "
-                       "addr=%p, event-class-name=\"%s\", "
-                       "event-class-id=%" PRId64,
-                       event, bt_ctf_event_class_get_name(event->event_class),
-                       bt_ctf_event_class_get_id(event_class));
+               BT_LOGW_STR("Event class is not part of a stream class.");
                goto error;
        }
 
@@ -111,10 +107,7 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class)
        /* Validate the trace (if any), the stream class, and the event class */
        trace = bt_ctf_stream_class_get_trace(stream_class);
        if (trace) {
-               BT_LOGD("Event's class is part of a trace: "
-                       "event-class-name=\"%s\", event-class-id=%" PRId64,
-                       bt_ctf_event_class_get_name(event_class),
-                       bt_ctf_event_class_get_id(event_class));
+               BT_LOGD_STR("Event's class is part of a trace.");
                packet_header_type = bt_ctf_trace_get_packet_header_type(trace);
                trace_valid = trace->valid;
                assert(trace_valid);
@@ -145,10 +138,7 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class)
                 * This means something went wrong during the validation
                 * process, not that the objects are invalid.
                 */
-               BT_LOGE("Failed to validate event: addr=%p, event-class-name=\"%s\", "
-                       "event-class-id=%" PRId64,
-                       event, bt_ctf_event_class_get_name(event->event_class),
-                       bt_ctf_event_class_get_id(event_class));
+               BT_LOGE("Failed to validate event and parents: ret=%d", ret);
                goto error;
        }
 
@@ -156,11 +146,7 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class)
                        validation_flags) {
                /* Invalid trace/stream class/event class */
                BT_LOGE("Invalid trace, stream class, or event class: "
-                       "event-addr=%p, event-class-name=\"%s\", "
-                       "event-class-id=%" PRId64 ", valid-flags=0x%x",
-                       event, bt_ctf_event_class_get_name(event->event_class),
-                       bt_ctf_event_class_get_id(event_class),
-                       validation_output.valid_flags);
+                       "valid-flags=0x%x", validation_output.valid_flags);
                goto error;
        }
 
@@ -715,10 +701,15 @@ void bt_ctf_event_destroy(struct bt_object *obj)
                bt_put(event->event_class);
        }
        g_hash_table_destroy(event->clock_values);
+       BT_LOGD_STR("Putting event's header field.");
        bt_put(event->event_header);
+       BT_LOGD_STR("Putting event's stream event context field.");
        bt_put(event->stream_event_context);
+       BT_LOGD_STR("Putting event's context field.");
        bt_put(event->context_payload);
+       BT_LOGD_STR("Putting event's payload field.");
        bt_put(event->fields_payload);
+       BT_LOGD_STR("Putting event's packet.");
        bt_put(event->packet);
        g_free(event);
 }
@@ -887,14 +878,15 @@ int bt_ctf_event_serialize(struct bt_ctf_event *event,
        assert(event);
        assert(pos);
 
-       BT_LOGD("Serializing event: "
+       BT_LOGV("Serializing event: "
                "event-addr=%p, event-class-name=\"%s\", "
-               "event-class-id=%" PRId64 ", pos-addr=%p, "
+               "event-class-id=%" PRId64 ", pos-offset=%" PRId64 ", "
                "native-bo=%s",
                event, bt_ctf_event_class_get_name(event->event_class),
                bt_ctf_event_class_get_id(event->event_class),
-               pos, bt_ctf_field_type_byte_order_string(native_byte_order));
+               pos->offset, bt_ctf_byte_order_string(native_byte_order));
 
+       BT_LOGV_STR("Serializing context field.");
        if (event->context_payload) {
                ret = bt_ctf_field_serialize(event->context_payload, pos,
                        native_byte_order);
@@ -909,6 +901,7 @@ int bt_ctf_event_serialize(struct bt_ctf_event *event,
                }
        }
 
+       BT_LOGV_STR("Serializing payload field.");
        if (event->fields_payload) {
                ret = bt_ctf_field_serialize(event->fields_payload, pos,
                        native_byte_order);
@@ -1042,9 +1035,13 @@ void bt_ctf_event_freeze(struct bt_ctf_event *event)
                event, bt_ctf_event_class_get_name(event->event_class),
                bt_ctf_event_class_get_id(event->event_class));
        bt_ctf_packet_freeze(event->packet);
+       BT_LOGD_STR("Freezing event's header field.");
        bt_ctf_field_freeze(event->event_header);
+       BT_LOGD_STR("Freezing event's stream event context field.");
        bt_ctf_field_freeze(event->stream_event_context);
+       BT_LOGD_STR("Freezing event's context field.");
        bt_ctf_field_freeze(event->context_payload);
+       BT_LOGD_STR("Freezing event's payload field.");
        bt_ctf_field_freeze(event->fields_payload);
        event->frozen = 1;
 }
This page took 0.029576 seconds and 4 git commands to generate.