lib_LTLIBRARIES = libbabeltrace-python-plugin-provider.la
-libbabeltrace_python_plugin_provider_la_SOURCES = python-plugin-provider.c
+libbabeltrace_python_plugin_provider_la_SOURCES = \
+ python-plugin-provider.c logging.c logging.h
libbabeltrace_python_plugin_provider_la_LDFLAGS = \
-version-info $(BABELTRACE_LIBRARY_VERSION) $(PYTHON_LIBS)
--- /dev/null
+/*
+ * 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 python_plugin_provider_log_level
+#include <babeltrace/logging-internal.h>
+
+BT_LOG_INIT_LOG_LEVEL(python_plugin_provider_log_level,
+ "BABELTRACE_PYTHON_PLUGIN_PROVIDER_LOG_LEVEL");
--- /dev/null
+#ifndef PYTHON_PLUGIN_PROVIDER_LOGGING_H
+#define PYTHON_PLUGIN_PROVIDER_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 python_plugin_provider_log_level
+#include <babeltrace/logging-internal.h>
+
+BT_LOG_LEVEL_EXTERN_SYMBOL(python_plugin_provider_log_level);
+
+#endif /* PYTHON_PLUGIN_PROVIDER_LOGGING_H */
* SOFTWARE.
*/
-#define BT_LOG_OUTPUT_LEVEL python_plugin_provider_log_level
#define BT_LOG_TAG "PLUGIN-PY"
-#include <babeltrace/logging-internal.h>
-
-/*
- * Must be before the rest because some of the headers below could
- * contain logging statements which need this symbol when expanded.
- */
-static int python_plugin_provider_log_level = BT_LOG_NONE;
+#include "logging.h"
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/compiler-internal.h>
static PyObject *py_try_load_plugin_module_func = NULL;
-static
-void __attribute__((constructor)) logging_ctor(void)
-{
- python_plugin_provider_log_level =
- bt_log_get_level_from_env("BABELTRACE_PYTHON_PLUGIN_PROVIDER_LOG_LEVEL");
-}
-
static
void print_python_traceback_warn(void)
{