- int ret = 0;
-
- if (!event_class) {
- BT_LOGW_STR("Invalid parameter: event class is NULL.");
- ret = -1;
- goto end;
- }
-
- if (event_class->frozen) {
- BT_LOGW("Invalid parameter: event class is frozen: "
- "addr=%p, name=\"%s\", id=%" PRId64,
- event_class, bt_event_class_get_name(event_class),
- bt_event_class_get_id(event_class));
- ret = -1;
- goto end;
- }
-
- switch (log_level) {
- case BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED:
- case BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY:
- case BT_EVENT_CLASS_LOG_LEVEL_ALERT:
- case BT_EVENT_CLASS_LOG_LEVEL_CRITICAL:
- case BT_EVENT_CLASS_LOG_LEVEL_ERROR:
- case BT_EVENT_CLASS_LOG_LEVEL_WARNING:
- case BT_EVENT_CLASS_LOG_LEVEL_NOTICE:
- case BT_EVENT_CLASS_LOG_LEVEL_INFO:
- case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM:
- case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM:
- case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS:
- case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE:
- case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT:
- case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION:
- case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE:
- case BT_EVENT_CLASS_LOG_LEVEL_DEBUG:
- break;
- default:
- BT_LOGW("Invalid parameter: unknown event class log level: "
- "addr=%p, name=\"%s\", id=%" PRId64 ", log-level=%d",
- event_class, bt_event_class_get_name(event_class),
- bt_event_class_get_id(event_class), log_level);
- ret = -1;
- goto end;
- }
-
- event_class->log_level = log_level;
- BT_LOGV("Set event class's log level: "
- "addr=%p, name=\"%s\", id=%" PRId64 ", log-level=%s",
- event_class, bt_event_class_get_name(event_class),
- bt_event_class_get_id(event_class),
- bt_event_class_log_level_string(log_level));
-
-end:
- return ret;
+ BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE(stream_class->assigns_automatic_event_class_id,
+ "Stream class does not automatically assigns event class IDs: "
+ "%![sc-]+S", stream_class);
+ return create_event_class_with_id(stream_class,
+ (uint64_t) stream_class->event_classes->len);