- if (!strcmp(name, "id") || !strcmp(name, "loglevel") ||
- !strcmp(name, "stream_id")) {
- if (!bt_value_is_integer(value)) {
- BT_LOGW("Invalid parameter: this event class's attribute must have an integer value: "
- "event-class-addr=%p, event-class-name=\"%s\", "
- "event-class-id=%" PRId64 ", attr-name=\"%s\", "
- "attr-type=%s", event_class,
- bt_ctf_event_class_get_name(event_class),
- bt_ctf_event_class_get_id(event_class), name,
- bt_value_type_string(bt_value_get_type(value)));
- ret = -1;
- goto end;
- }
- } else if (!strcmp(name, "name") || !strcmp(name, "model.emf.uri") ||
- !strcmp(name, "loglevel_string")) {
- if (!bt_value_is_string(value)) {
- BT_LOGW("Invalid parameter: this event class's attribute must have a string value: "
- "event-class-addr=%p, event-class-name=\"%s\", "
- "event-class-id=%" PRId64 ", attr-name=\"%s\", "
- "attr-type=%s", event_class,
- bt_ctf_event_class_get_name(event_class),
- bt_ctf_event_class_get_id(event_class), name,
- bt_value_type_string(bt_value_get_type(value)));
- ret = -1;
- goto end;
- }
- } else {
- /* unknown attribute */
- BT_LOGW("Invalid parameter: unknown event class's attribute name: "
- "event-class-addr=%p, event-class-name=\"%s\", "
- "event-class-id=%" PRId64 ", attr-name=\"%s\"",
- event_class, bt_ctf_event_class_get_name(event_class),
- bt_ctf_event_class_get_id(event_class), name);
+ 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);