sink.text.details: honor component's initial log level
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 18 Jun 2019 18:48:54 +0000 (14:48 -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: If24cf10be949c4e637b4677b9780c00a58e14df2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1500
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/cli/babeltrace2.c
src/plugins/text/details/Makefile.am
src/plugins/text/details/details.c
src/plugins/text/details/details.h
src/plugins/text/details/logging.c [deleted file]
src/plugins/text/details/logging.h [deleted file]

index d3cabdc920be1e079e92dce1993bf440c05bbb31..8c4b18a6f0b8121766fbcde97db4ad9c9cb1ee9b 100644 (file)
@@ -51,7 +51,6 @@
 static const char* log_level_env_var_names[] = {
        "BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL",
        "BABELTRACE_PYTHON_BT2_LOG_LEVEL",
-       "BABELTRACE_SINK_TEXT_DETAILS_LOG_LEVEL",
        "BABELTRACE_SRC_CTF_FS_LOG_LEVEL",
        NULL,
 };
index fefae1023825a0577b5cbf7548c56f615e6b8aab..7b230478e8d4f9292decd8c6a748fea1c4e71931 100644 (file)
@@ -5,5 +5,4 @@ libbabeltrace2_plugin_text_details_cc_la_SOURCES = \
        details.c details.h \
        write.c write.h \
        obj-lifetime-mgmt.c obj-lifetime-mgmt.h \
-       colors.h \
-       logging.c logging.h
+       colors.h
index 8f09efa4050572ffc427c717b9d1a6aa162ff8e1..8c1f66e38a52ab1b3e99e8b58451e960b62c91c7 100644 (file)
@@ -20,8 +20,9 @@
  * SOFTWARE.
  */
 
+#define BT_LOG_OUTPUT_LEVEL (details_comp->log_level)
 #define BT_LOG_TAG "PLUGIN/SINK.TEXT.DETAILS"
-#include "logging.h"
+#include "logging/log.h"
 
 #include <babeltrace2/babeltrace.h>
 
@@ -181,14 +182,19 @@ end:
 }
 
 static
-struct details_comp *create_details_comp(void)
+struct details_comp *create_details_comp(
+               bt_self_component_sink *self_comp_sink)
 {
        struct details_comp *details_comp = g_new0(struct details_comp, 1);
+       bt_self_component *self_comp =
+               bt_self_component_sink_as_self_component(self_comp_sink);
 
        if (!details_comp) {
                goto error;
        }
 
+       details_comp->log_level = bt_component_get_logging_level(
+               bt_self_component_as_component(self_comp));
        details_comp->meta = g_hash_table_new_full(g_direct_hash,
                g_direct_equal, NULL,
                (GDestroyNotify) details_destroy_details_trace_class_meta);
@@ -392,7 +398,7 @@ bt_self_component_status details_init(bt_self_component_sink *comp,
                goto error;
        }
 
-       details_comp = create_details_comp();
+       details_comp = create_details_comp(comp);
        if (!details_comp) {
                status = BT_SELF_COMPONENT_STATUS_NOMEM;
                goto error;
index 41f6acfbda94a467d43822a05f5d77495abdc0a5..52a28cde06c895e7de03bbbc3cc74a9fde59359b 100644 (file)
@@ -74,6 +74,8 @@ struct details_trace {
 
 /* A `sink.text.details` component */
 struct details_comp {
+       bt_logging_level log_level;
+
        /* Component's configuration */
        struct {
                /* Write metadata objects */
diff --git a/src/plugins/text/details/logging.c b/src/plugins/text/details/logging.c
deleted file mode 100644 (file)
index 6198267..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2019 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_text_details_log_level
-#include "logging/log.h"
-
-BT_LOG_INIT_LOG_LEVEL(bt_plugin_text_details_log_level,
-       "BABELTRACE_SINK_TEXT_DETAILS_LOG_LEVEL");
diff --git a/src/plugins/text/details/logging.h b/src/plugins/text/details/logging.h
deleted file mode 100644 (file)
index 6c881b2..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef BABELTRACE_PLUGINS_TEXT_DETAILS_LOGGING_H
-#define BABELTRACE_PLUGINS_TEXT_DETAILS_LOGGING_H
-
-/*
- * Copyright (c) 2019 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_text_details_log_level
-#include "logging/log.h"
-
-BT_LOG_LEVEL_EXTERN_SYMBOL(bt_plugin_text_details_log_level);
-
-#endif /* BABELTRACE_PLUGINS_TEXT_DETAILS_LOGGING_H */
This page took 0.031814 seconds and 4 git commands to generate.