From 9d87d0ead74ed4f7db76f5d1a842a3a525a792d9 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Sat, 15 Jun 2019 01:59:47 -0400 Subject: [PATCH] sink.utils.counter: honor component's initial log level Signed-off-by: Philippe Proulx Change-Id: Ib5bc755a8ff3db0a869b448f83dd9a888ee7df9b Reviewed-on: https://review.lttng.org/c/babeltrace/+/1464 Tested-by: jenkins Reviewed-by: Francis Deslauriers --- src/cli/babeltrace2.c | 1 - src/plugins/utils/counter/Makefile.am | 4 +--- src/plugins/utils/counter/counter.c | 6 +++++- src/plugins/utils/counter/counter.h | 1 + src/plugins/utils/counter/logging.c | 27 ----------------------- src/plugins/utils/counter/logging.h | 31 --------------------------- 6 files changed, 7 insertions(+), 63 deletions(-) delete mode 100644 src/plugins/utils/counter/logging.c delete mode 100644 src/plugins/utils/counter/logging.h diff --git a/src/cli/babeltrace2.c b/src/cli/babeltrace2.c index 679439a5..dfcdd2dd 100644 --- a/src/cli/babeltrace2.c +++ b/src/cli/babeltrace2.c @@ -50,7 +50,6 @@ */ static const char* log_level_env_var_names[] = { "BABELTRACE_FLT_LTTNG_UTILS_DEBUG_INFO_LOG_LEVEL", - "BABELTRACE_FLT_UTILS_COUNTER_LOG_LEVEL", "BABELTRACE_FLT_UTILS_MUXER_LOG_LEVEL", "BABELTRACE_FLT_UTILS_TRIMMER_LOG_LEVEL", "BABELTRACE_PLUGIN_CTF_BFCR_LOG_LEVEL", diff --git a/src/plugins/utils/counter/Makefile.am b/src/plugins/utils/counter/Makefile.am index ef060f1a..0cc47e53 100644 --- a/src/plugins/utils/counter/Makefile.am +++ b/src/plugins/utils/counter/Makefile.am @@ -1,6 +1,4 @@ noinst_LTLIBRARIES = libbabeltrace2-plugin-counter-cc.la libbabeltrace2_plugin_counter_cc_la_SOURCES = \ counter.c \ - counter.h \ - logging.c \ - logging.h + counter.h diff --git a/src/plugins/utils/counter/counter.c b/src/plugins/utils/counter/counter.c index 42ac5ad6..2438a4e0 100644 --- a/src/plugins/utils/counter/counter.c +++ b/src/plugins/utils/counter/counter.c @@ -20,8 +20,9 @@ * SOFTWARE. */ +#define BT_LOG_OUTPUT_LEVEL (counter->log_level) #define BT_LOG_TAG "PLUGIN/FLT.UTILS.COUNTER" -#include "logging.h" +#include "logging/log.h" #include #include "common/macros.h" @@ -150,6 +151,9 @@ bt_self_component_status counter_init( goto error; } + counter->log_level = bt_component_get_logging_level( + bt_self_component_as_component( + bt_self_component_sink_as_self_component(component))); ret = bt_self_component_sink_add_input_port(component, "in", NULL, NULL); if (ret != BT_SELF_COMPONENT_STATUS_OK) { diff --git a/src/plugins/utils/counter/counter.h b/src/plugins/utils/counter/counter.h index 4052736e..81329090 100644 --- a/src/plugins/utils/counter/counter.h +++ b/src/plugins/utils/counter/counter.h @@ -48,6 +48,7 @@ struct counter { uint64_t at; uint64_t step; bool hide_zero; + bt_logging_level log_level; }; BT_HIDDEN diff --git a/src/plugins/utils/counter/logging.c b/src/plugins/utils/counter/logging.c deleted file mode 100644 index 6fc046e1..00000000 --- a/src/plugins/utils/counter/logging.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2017 Philippe Proulx - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#define BT_LOG_OUTPUT_LEVEL bt_plugin_utils_counter_log_level -#include "logging/log.h" - -BT_LOG_INIT_LOG_LEVEL(bt_plugin_utils_counter_log_level, - "BABELTRACE_FLT_UTILS_COUNTER_LOG_LEVEL"); diff --git a/src/plugins/utils/counter/logging.h b/src/plugins/utils/counter/logging.h deleted file mode 100644 index 83192434..00000000 --- a/src/plugins/utils/counter/logging.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef PLUGINS_UTILS_COUNTER_LOGGING_H -#define PLUGINS_UTILS_COUNTER_LOGGING_H - -/* - * Copyright (c) 2017 Philippe Proulx - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#define BT_LOG_OUTPUT_LEVEL bt_plugin_utils_counter_log_level -#include "logging/log.h" - -BT_LOG_LEVEL_EXTERN_SYMBOL(bt_plugin_utils_counter_log_level); - -#endif /* PLUGINS_UTILS_COUNTER_LOGGING_H */ -- 2.34.1