sink.utils.counter: honor component's initial log level
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 15 Jun 2019 05:59:47 +0000 (01:59 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 20 Jun 2019 18:01:16 +0000 (14:01 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ib5bc755a8ff3db0a869b448f83dd9a888ee7df9b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1464
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/cli/babeltrace2.c
src/plugins/utils/counter/Makefile.am
src/plugins/utils/counter/counter.c
src/plugins/utils/counter/counter.h
src/plugins/utils/counter/logging.c [deleted file]
src/plugins/utils/counter/logging.h [deleted file]

index 679439a562ca07835890767b2dcdb3f3247d32d8..dfcdd2dd14e7b7dbcdbc2ad50b46b73cc99532cc 100644 (file)
@@ -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",
index ef060f1a8361bf484912f2cdb37b8c8e799987cd..0cc47e530c14ddf8dbd8f410bee319001dc705d7 100644 (file)
@@ -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
index 42ac5ad6585b310efdad5c1fae0730ad4ace0341..2438a4e02a8c3dc028c5e6c3ee106ca9283151f4 100644 (file)
@@ -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 <babeltrace2/babeltrace.h>
 #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) {
index 4052736ecdddb03aa00491eb4ecb9c7afe5c2c57..81329090c8cf6f0c116d808c5c19032f3c7564bd 100644 (file)
@@ -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 (file)
index 6fc046e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * 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 (file)
index 8319243..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef PLUGINS_UTILS_COUNTER_LOGGING_H
-#define PLUGINS_UTILS_COUNTER_LOGGING_H
-
-/*
- * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * 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 */
This page took 0.028018 seconds and 4 git commands to generate.