plugins/ctf/lttng-live: use standard logging files and macros
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 31 May 2017 16:57:58 +0000 (12:57 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 9 Jun 2017 20:58:13 +0000 (16:58 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/ctf/lttng-live/Makefile.am
plugins/ctf/lttng-live/data-stream.c
plugins/ctf/lttng-live/logging.c [new file with mode: 0644]
plugins/ctf/lttng-live/logging.h [new file with mode: 0644]
plugins/ctf/lttng-live/lttng-live-internal.h
plugins/ctf/lttng-live/lttng-live.c
plugins/ctf/lttng-live/metadata.c
plugins/ctf/lttng-live/viewer-connection.c

index dcd310ee7b92681dcf0fb80582bf01bfe2c839fb..d65662e2669afb73ea874518c9578881212a717f 100644 (file)
@@ -4,6 +4,7 @@ libbabeltrace_plugin_ctf_lttng_live_la_SOURCES = lttng-live.c \
                data-stream.c lttng-live-internal.h \
                data-stream.h metadata.c metadata.h \
                viewer-connection.c viewer-connection.h \
-               lttng-viewer-abi.h
+               lttng-viewer-abi.h \
+               logging.c logging.h
 
 noinst_LTLIBRARIES = libbabeltrace-plugin-ctf-lttng-live.la
index c344923418bc1f6866807ddcf4e75366dd19f193..5669b614e923847a9866d6a93e01e430a6cabbc8 100644 (file)
@@ -22,6 +22,9 @@
  * SOFTWARE.
  */
 
+#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-SRC-DS"
+#include "logging.h"
+
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -33,8 +36,6 @@
 #include "../common/notif-iter/notif-iter.h"
 #include <assert.h>
 
-#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-DS"
-
 #include "data-stream.h"
 
 static
diff --git a/plugins/ctf/lttng-live/logging.c b/plugins/ctf/lttng-live/logging.c
new file mode 100644 (file)
index 0000000..e6f3c0c
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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 lttng_live_log_level
+#include <babeltrace/logging-internal.h>
+
+BT_LOG_INIT_LOG_LEVEL(lttng_live_log_level, "BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_SRC_LOG_LEVEL");
diff --git a/plugins/ctf/lttng-live/logging.h b/plugins/ctf/lttng-live/logging.h
new file mode 100644 (file)
index 0000000..e3f1632
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef LTTNG_LIVE_LOGGING_H
+#define LTTNG_LIVE_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 lttng_live_log_level
+#include <babeltrace/logging-internal.h>
+
+BT_LOG_LEVEL_EXTERN_SYMBOL(lttng_live_log_level);
+
+#endif /* LTTNG_LIVE_LOGGING_H */
index fa5409270865c77daa746807b7134a684f4a9fb9..115ac76b2eef36de595b225f484618d534cdd70c 100644 (file)
  * SOFTWARE.
  */
 
-extern int bt_lttng_live_log_level;
-
 #include <stdbool.h>
 
 #include <babeltrace/babeltrace-internal.h>
-
-#define BT_LOG_OUTPUT_LEVEL bt_lttng_live_log_level
-#include <babeltrace/logging-internal.h>
-
 #include <babeltrace/graph/component.h>
 #include <babeltrace/graph/notification-iterator.h>
 #include <babeltrace/graph/clock-class-priority-map.h>
index a84c9cc459a60cc225c4813c393794dc8197080b..33cd94a00280d6480ed6cce397594b526514fb76 100644 (file)
@@ -27,6 +27,9 @@
  * SOFTWARE.
  */
 
+#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-SRC"
+#include "logging.h"
+
 #include <babeltrace/ctf-ir/packet.h>
 #include <babeltrace/graph/component-source.h>
 #include <babeltrace/graph/private-port.h>
@@ -48,9 +51,6 @@
 #include <unistd.h>
 #include <plugins-common.h>
 
-#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE"
-#define BT_LOGLEVEL_NAME "BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_LOG_LEVEL"
-
 #include "data-stream.h"
 #include "metadata.h"
 #include "lttng-live-internal.h"
@@ -83,9 +83,6 @@ static const char *print_state(struct lttng_live_stream_iterator *s)
                        print_state(stream), stream->last_returned_inactivity_timestamp,        \
                        stream->current_inactivity_timestamp)
 
-BT_HIDDEN
-int bt_lttng_live_log_level = BT_LOG_NONE;
-
 BT_HIDDEN
 int lttng_live_add_port(struct lttng_live_component *lttng_live,
                struct lttng_live_stream_iterator *stream_iter)
@@ -1117,9 +1114,3 @@ end:
        bt_put(self_port);
        return status;
 }
-
-static
-void __attribute__((constructor)) bt_lttng_live_logging_ctor(void)
-{
-        bt_lttng_live_log_level = bt_log_get_level_from_env(BT_LOGLEVEL_NAME);
-}
index 7c8ce4dddb49498fdd8f82a5a34999c5ea3b74ab..b71a42a535632430147049b7116385be9de44d82 100644 (file)
@@ -23,6 +23,9 @@
  * SOFTWARE.
  */
 
+#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-SRC-METADATA"
+#include "logging.h"
+
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -32,8 +35,6 @@
 #include <babeltrace/compat/memstream-internal.h>
 #include <babeltrace/graph/graph.h>
 
-#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-METADATA"
-
 #include "metadata.h"
 #include "../common/metadata/decoder.h"
 
index 9b48421eb390082aa643616dd38012a5ef8c5b21..9f61f160162842afaa14a37e6962acc9300ec992 100644 (file)
@@ -20,6 +20,9 @@
  * SOFTWARE.
  */
 
+#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-SRC-VIEWER"
+#include "logging.h"
+
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -39,8 +42,6 @@
 #include <babeltrace/common-internal.h>
 #include <babeltrace/graph/graph.h>
 
-#define BT_LOG_TAG "PLUGIN-CTF-LTTNG-LIVE-VIEWER"
-
 #include "lttng-live-internal.h"
 #include "viewer-connection.h"
 #include "lttng-viewer-abi.h"
This page took 0.028366 seconds and 4 git commands to generate.