From 82e80647233f0ac9131d88b9664086bd5f765bb9 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 17 Jun 2019 13:19:57 -0400 Subject: [PATCH] utils.sink.counter: use BT_COMP_LOG*() instead of BT_LOG*() Signed-off-by: Philippe Proulx Change-Id: Ic963197053b374df6b891c8b6af1050255c626d9 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1481 Tested-by: jenkins Reviewed-by: Francis Deslauriers --- src/plugins/utils/counter/counter.c | 12 +++++++----- src/plugins/utils/counter/counter.h | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/utils/counter/counter.c b/src/plugins/utils/counter/counter.c index 2438a4e0..f8561e76 100644 --- a/src/plugins/utils/counter/counter.c +++ b/src/plugins/utils/counter/counter.c @@ -20,9 +20,10 @@ * SOFTWARE. */ +#define BT_COMP_LOG_SELF_COMP (counter->self_comp) #define BT_LOG_OUTPUT_LEVEL (counter->log_level) #define BT_LOG_TAG "PLUGIN/FLT.UTILS.COUNTER" -#include "logging/log.h" +#include "plugins/comp-logging.h" #include #include "common/macros.h" @@ -151,9 +152,10 @@ bt_self_component_status counter_init( goto error; } + counter->self_comp = + bt_self_component_sink_as_self_component(component); counter->log_level = bt_component_get_logging_level( - bt_self_component_as_component( - bt_self_component_sink_as_self_component(component))); + bt_self_component_as_component(counter->self_comp)); ret = bt_self_component_sink_add_input_port(component, "in", NULL, NULL); if (ret != BT_SELF_COMPONENT_STATUS_OK) { @@ -165,7 +167,7 @@ bt_self_component_status counter_init( step = bt_value_map_borrow_entry_value_const(params, "step"); if (step) { if (!bt_value_is_unsigned_integer(step)) { - BT_LOGE("`step` parameter: expecting an unsigned integer value: " + BT_COMP_LOGE("`step` parameter: expecting an unsigned integer value: " "type=%s", bt_common_value_type_string( bt_value_get_type(step))); goto error; @@ -177,7 +179,7 @@ bt_self_component_status counter_init( hide_zero = bt_value_map_borrow_entry_value_const(params, "hide-zero"); if (hide_zero) { if (!bt_value_is_bool(hide_zero)) { - BT_LOGE("`hide-zero` parameter: expecting a boolean value: " + BT_COMP_LOGE("`hide-zero` parameter: expecting a boolean value: " "type=%s", bt_common_value_type_string( bt_value_get_type(hide_zero))); goto error; diff --git a/src/plugins/utils/counter/counter.h b/src/plugins/utils/counter/counter.h index 81329090..48135ef3 100644 --- a/src/plugins/utils/counter/counter.h +++ b/src/plugins/utils/counter/counter.h @@ -49,6 +49,7 @@ struct counter { uint64_t step; bool hide_zero; bt_logging_level log_level; + bt_self_component *self_comp; }; BT_HIDDEN -- 2.34.1