switch (event_rule_type) {
case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
{
- enum lttng_loglevel log_level_min, log_level_max;
- if (!loglevel_parse_range_string(str, &log_level_min, &log_level_max)) {
+ enum lttng_loglevel log_level_least_severe, log_level_most_severe;
+ if (!loglevel_parse_range_string(
+ str, &log_level_least_severe, &log_level_most_severe)) {
goto error;
}
/* Only support VAL and VAL.. for now. */
- if (log_level_min != log_level_max && log_level_max != LTTNG_LOGLEVEL_EMERG) {
+ if (log_level_least_severe != log_level_most_severe &&
+ log_level_most_severe != LTTNG_LOGLEVEL_EMERG) {
goto error;
}
- *log_level = (int) log_level_min;
- *log_level_only = log_level_min == log_level_max;
+ *log_level = (int) log_level_least_severe;
+ *log_level_only = log_level_least_severe == log_level_most_severe;
break;
}
case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
{
- enum lttng_loglevel_log4j log_level_min, log_level_max;
- if (!loglevel_log4j_parse_range_string(str, &log_level_min, &log_level_max)) {
+ enum lttng_loglevel_log4j log_level_least_severe, log_level_most_severe;
+ if (!loglevel_log4j_parse_range_string(
+ str, &log_level_least_severe, &log_level_most_severe)) {
goto error;
}
/* Only support VAL and VAL.. for now. */
- if (log_level_min != log_level_max && log_level_max != LTTNG_LOGLEVEL_LOG4J_FATAL) {
+ if (log_level_least_severe != log_level_most_severe &&
+ log_level_most_severe != LTTNG_LOGLEVEL_LOG4J_FATAL) {
goto error;
}
- *log_level = (int) log_level_min;
- *log_level_only = log_level_min == log_level_max;
+ *log_level = (int) log_level_least_severe;
+ *log_level_only = log_level_least_severe == log_level_most_severe;
break;
}
case LTTNG_EVENT_RULE_TYPE_LOG4J2_LOGGING:
{
- enum lttng_loglevel_log4j2 log_level_min, log_level_max;
- if (!loglevel_log4j2_parse_range_string(str, &log_level_min, &log_level_max)) {
+ enum lttng_loglevel_log4j2 log_level_least_severe, log_level_most_severe;
+ if (!loglevel_log4j2_parse_range_string(
+ str, &log_level_least_severe, &log_level_most_severe)) {
goto error;
}
/* Only support VAL and VAL.. for now. */
- if (log_level_min != log_level_max &&
- log_level_max != LTTNG_LOGLEVEL_LOG4J2_FATAL) {
+ if (log_level_least_severe != log_level_most_severe &&
+ log_level_most_severe != LTTNG_LOGLEVEL_LOG4J2_FATAL) {
goto error;
}
- *log_level = (int) log_level_min;
- *log_level_only = log_level_min == log_level_max;
+ *log_level = (int) log_level_least_severe;
+ *log_level_only = log_level_least_severe == log_level_most_severe;
break;
}
case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
{
- enum lttng_loglevel_jul log_level_min, log_level_max;
- if (!loglevel_jul_parse_range_string(str, &log_level_min, &log_level_max)) {
+ enum lttng_loglevel_jul log_level_least_severe, log_level_most_severe;
+ if (!loglevel_jul_parse_range_string(
+ str, &log_level_least_severe, &log_level_most_severe)) {
goto error;
}
/* Only support VAL and VAL.. for now. */
- if (log_level_min != log_level_max && log_level_max != LTTNG_LOGLEVEL_JUL_SEVERE) {
+ if (log_level_least_severe != log_level_most_severe &&
+ log_level_most_severe != LTTNG_LOGLEVEL_JUL_SEVERE) {
goto error;
}
- *log_level = (int) log_level_min;
- *log_level_only = log_level_min == log_level_max;
+ *log_level = (int) log_level_least_severe;
+ *log_level_only = log_level_least_severe == log_level_most_severe;
break;
}
case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
{
- enum lttng_loglevel_python log_level_min, log_level_max;
- if (!loglevel_python_parse_range_string(str, &log_level_min, &log_level_max)) {
+ enum lttng_loglevel_python log_level_least_severe, log_level_most_severe;
+ if (!loglevel_python_parse_range_string(
+ str, &log_level_least_severe, &log_level_most_severe)) {
goto error;
}
/* Only support VAL and VAL.. for now. */
- if (log_level_min != log_level_max &&
- log_level_max != LTTNG_LOGLEVEL_PYTHON_CRITICAL) {
+ if (log_level_least_severe != log_level_most_severe &&
+ log_level_most_severe != LTTNG_LOGLEVEL_PYTHON_CRITICAL) {
goto error;
}
- *log_level = (int) log_level_min;
- *log_level_only = log_level_min == log_level_max;
+ *log_level = (int) log_level_least_severe;
+ *log_level_only = log_level_least_severe == log_level_most_severe;
break;
}
default:
static bool loglevel_parse_range_string_common(const char *str,
const struct loglevel_name_value *nvs,
size_t nvs_count,
- int default_max,
- int *min,
- int *max)
+ int default_most_severe,
+ int *least_severe,
+ int *most_severe)
{
bool ret;
int i;
}
/*
- * Record the min value and skip over the loglevel name found
+ * Record the least_severe value and skip over the loglevel name found
* previously.
*/
- *min = nv->value;
+ *least_severe = nv->value;
str += strlen(nv->name);
/*
* If we are at the end of 'str', only one loglevel name was specified,
- * it is also the max.
+ * it is also the most_severe.
*/
if (*str == '\0') {
- *max = nv->value;
+ *most_severe = nv->value;
ret = true;
goto end;
}
str += strlen("..");
/*
- * If we are at the end of 'str' after the separator, set
- * the default max value for the domain as the max.
+ * If we are at the end of 'str' after the separator, set the default
+ * most_severe value for the domain as the most_severe.
*/
if (*str == '\0') {
- *max = default_max;
+ *most_severe = default_most_severe;
ret = true;
goto end;
}
}
/*
- * Record the max value for the loglevel found in 'str'.
+ * Record the most_severe value for the loglevel found in 'str'.
*/
- *max = nv->value;
+ *most_severe = nv->value;
ret = true;
goto end;
}
bool loglevel_parse_range_string(const char *str,
- enum lttng_loglevel *min,
- enum lttng_loglevel *max)
+ enum lttng_loglevel *least_severe,
+ enum lttng_loglevel *most_severe)
{
- int min_int, max_int;
+ int least_severe_int, most_severe_int;
const bool ret = loglevel_parse_range_string_common(str,
loglevel_values,
ARRAY_SIZE(loglevel_values),
LTTNG_LOGLEVEL_EMERG,
- &min_int,
- &max_int);
+ &least_severe_int,
+ &most_severe_int);
- *min = (lttng_loglevel) min_int;
- *max = (lttng_loglevel) max_int;
+ *least_severe = (lttng_loglevel) least_severe_int;
+ *most_severe = (lttng_loglevel) most_severe_int;
return ret;
}
}
bool loglevel_log4j_parse_range_string(const char *str,
- enum lttng_loglevel_log4j *min,
- enum lttng_loglevel_log4j *max)
+ enum lttng_loglevel_log4j *least_severe,
+ enum lttng_loglevel_log4j *most_severe)
{
- int min_int, max_int;
+ int least_severe_int, most_severe_int;
const bool ret = loglevel_parse_range_string_common(str,
loglevel_log4j_values,
ARRAY_SIZE(loglevel_log4j_values),
LTTNG_LOGLEVEL_LOG4J_FATAL,
- &min_int,
- &max_int);
+ &least_severe_int,
+ &most_severe_int);
- *min = (lttng_loglevel_log4j) min_int;
- *max = (lttng_loglevel_log4j) max_int;
+ *least_severe = (lttng_loglevel_log4j) least_severe_int;
+ *most_severe = (lttng_loglevel_log4j) most_severe_int;
return ret;
}
}
bool loglevel_log4j2_parse_range_string(const char *str,
- enum lttng_loglevel_log4j2 *min,
- enum lttng_loglevel_log4j2 *max)
+ enum lttng_loglevel_log4j2 *least_severe,
+ enum lttng_loglevel_log4j2 *most_severe)
{
- int min_int, max_int;
+ int least_severe_int, most_severe_int;
bool ret = loglevel_parse_range_string_common(str,
loglevel_log4j2_values,
ARRAY_SIZE(loglevel_log4j2_values),
LTTNG_LOGLEVEL_LOG4J2_FATAL,
- &min_int,
- &max_int);
+ &least_severe_int,
+ &most_severe_int);
- *min = (lttng_loglevel_log4j2) min_int;
- *max = (lttng_loglevel_log4j2) max_int;
+ *least_severe = (lttng_loglevel_log4j2) least_severe_int;
+ *most_severe = (lttng_loglevel_log4j2) most_severe_int;
return ret;
}
}
bool loglevel_jul_parse_range_string(const char *str,
- enum lttng_loglevel_jul *min,
- enum lttng_loglevel_jul *max)
+ enum lttng_loglevel_jul *least_severe,
+ enum lttng_loglevel_jul *most_severe)
{
- int min_int, max_int;
+ int least_severe_int, most_severe_int;
const bool ret = loglevel_parse_range_string_common(str,
loglevel_jul_values,
ARRAY_SIZE(loglevel_jul_values),
LTTNG_LOGLEVEL_JUL_SEVERE,
- &min_int,
- &max_int);
+ &least_severe_int,
+ &most_severe_int);
- *min = (lttng_loglevel_jul) min_int;
- *max = (lttng_loglevel_jul) max_int;
+ *least_severe = (lttng_loglevel_jul) least_severe_int;
+ *most_severe = (lttng_loglevel_jul) most_severe_int;
return ret;
}
}
bool loglevel_python_parse_range_string(const char *str,
- enum lttng_loglevel_python *min,
- enum lttng_loglevel_python *max)
+ enum lttng_loglevel_python *least_severe,
+ enum lttng_loglevel_python *most_severe)
{
- int min_int, max_int;
+ int least_severe_int, most_severe_int;
const bool ret = loglevel_parse_range_string_common(str,
loglevel_python_values,
ARRAY_SIZE(loglevel_python_values),
LTTNG_LOGLEVEL_PYTHON_CRITICAL,
- &min_int,
- &max_int);
+ &least_severe_int,
+ &most_severe_int);
- *min = (lttng_loglevel_python) min_int;
- *max = (lttng_loglevel_python) max_int;
+ *least_severe = (lttng_loglevel_python) least_severe_int;
+ *most_severe = (lttng_loglevel_python) most_severe_int;
return ret;
}
int loglevel_name_to_value(const char *name, enum lttng_loglevel *loglevel);
bool loglevel_parse_range_string(const char *str,
- enum lttng_loglevel *min,
- enum lttng_loglevel *max);
+ enum lttng_loglevel *least_severe,
+ enum lttng_loglevel *most_severe);
int loglevel_log4j_name_to_value(const char *name, enum lttng_loglevel_log4j *loglevel);
bool loglevel_log4j_parse_range_string(const char *str,
- enum lttng_loglevel_log4j *min,
- enum lttng_loglevel_log4j *max);
+ enum lttng_loglevel_log4j *least_severe,
+ enum lttng_loglevel_log4j *most_severe);
int loglevel_log4j2_name_to_value(const char *name, enum lttng_loglevel_log4j2 *loglevel);
bool loglevel_log4j2_parse_range_string(const char *str,
- enum lttng_loglevel_log4j2 *min,
- enum lttng_loglevel_log4j2 *max);
+ enum lttng_loglevel_log4j2 *least_severe,
+ enum lttng_loglevel_log4j2 *most_severe);
int loglevel_jul_name_to_value(const char *name, enum lttng_loglevel_jul *loglevel);
bool loglevel_jul_parse_range_string(const char *str,
- enum lttng_loglevel_jul *min,
- enum lttng_loglevel_jul *max);
+ enum lttng_loglevel_jul *least_severe,
+ enum lttng_loglevel_jul *most_severe);
int loglevel_python_name_to_value(const char *name, enum lttng_loglevel_python *loglevel);
bool loglevel_python_parse_range_string(const char *str,
- enum lttng_loglevel_python *min,
- enum lttng_loglevel_python *max);
+ enum lttng_loglevel_python *least_severe,
+ enum lttng_loglevel_python *most_severe);
const char *loglevel_value_to_name(int loglevel);