#define DS_TYPE_DERIVE 2
#define DS_TYPE_ABSOLUTE 3
+#define DS_TYPE_TO_STRING(t) (t == DS_TYPE_COUNTER) ? "counter" : \
+ (t == DS_TYPE_GAUGE) ? "gauge" : \
+ (t == DS_TYPE_DERIVE) ? "derive" : \
+ (t == DS_TYPE_ABSOLUTE) ? "absolute" : \
+ "unknown"
+
+
#ifndef LOG_ERR
# define LOG_ERR 3
#endif
{
ERROR ("db query utils: udb_legacy_result_handle_result: "
"Parsing `%s' as %s failed.", value_str,
- (r->ds->ds[0].type == DS_TYPE_COUNTER) ? "counter" : "gauge");
+ DS_TYPE_TO_STRING (r->ds->ds[0].type));
errno = EINVAL;
return (-1);
}
if (0 != parse_value (value_str, &vl.values[i], r->ds->ds[i].type))
{
ERROR ("db query utils: udb_result_submit: Parsing `%s' as %s failed.",
- value_str,
- (r->ds->ds[i].type == DS_TYPE_COUNTER) ? "counter" : "gauge");
+ value_str, DS_TYPE_TO_STRING (r->ds->ds[i].type));
errno = EINVAL;
return (-1);
}