cli: use standard logging files and macros
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 31 May 2017 18:32:36 +0000 (14:32 -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>
cli/Makefile.am
cli/babeltrace.c
cli/logging.c [new file with mode: 0644]
cli/logging.h

index 5f07bf19b7c17543d5a5c58c4270dcfd093a4197..c45ecd2c83ff7b4586f056ec9ad88debb0f96943 100644 (file)
@@ -25,7 +25,7 @@ babeltrace_bin_SOURCES = \
        babeltrace-cfg-cli-args-connect.h \
        babeltrace-cfg-cli-args-default.h \
        babeltrace-cfg-cli-args-default.c \
-       logging.h
+       logging.c logging.h
 
 # -Wl,--no-as-needed is needed for recent gold linker who seems to think
 # it knows better and considers libraries with constructors having
index fbf611417130c5c47c49879ce1764b278b7925ef..8e4755a6f4204c6efce8061a6e556007d8f2552e 100644 (file)
@@ -26,6 +26,9 @@
  * SOFTWARE.
  */
 
+#define BT_LOG_TAG "CLI"
+#include "logging.h"
+
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/plugin/plugin.h>
 #include <babeltrace/common-internal.h>
@@ -54,9 +57,6 @@
 #include "babeltrace-cfg-cli-args.h"
 #include "babeltrace-cfg-cli-args-default.h"
 
-#define BT_LOG_TAG "CLI"
-#include "logging.h"
-
 #define ENV_BABELTRACE_WARN_COMMAND_NAME_DIRECTORY_CLASH "BABELTRACE_CLI_WARN_COMMAND_NAME_DIRECTORY_CLASH"
 
 /* Application's processing graph (weak) */
@@ -65,9 +65,6 @@ static bool canceled = false;
 
 GPtrArray *loaded_plugins;
 
-BT_HIDDEN
-int bt_cli_log_level = BT_LOG_NONE;
-
 static
 void sigint_handler(int signum)
 {
diff --git a/cli/logging.c b/cli/logging.c
new file mode 100644 (file)
index 0000000..52d531c
--- /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 bt_cli_log_level
+#include <babeltrace/logging-internal.h>
+
+BT_LOG_INIT_LOG_LEVEL(bt_cli_log_level, "BABELTRACE_CLI_LOG_LEVEL");
index b1aee09f06b48e06f1ebd75b3118f4934c1e24b1..ccc6c527e1b664ac64c52690217074c02cf204d7 100644 (file)
@@ -2,7 +2,7 @@
 #define CLI_LOGGING_H
 
 /*
- * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
+ * 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
  * SOFTWARE.
  */
 
-#include <babeltrace/babeltrace-internal.h>
-
 #define BT_LOG_OUTPUT_LEVEL bt_cli_log_level
-
 #include <babeltrace/logging-internal.h>
 
-BT_HIDDEN
-int bt_cli_log_level;
+BT_LOG_LEVEL_EXTERN_SYMBOL(bt_cli_log_level);
 
 #endif /* CLI_LOGGING_H */
This page took 0.026858 seconds and 4 git commands to generate.