From: Michael Jeanson Date: Fri, 2 Jun 2017 17:43:18 +0000 (-0400) Subject: Add logging to compat X-Git-Tag: v2.0.0-pre2~115 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=18fc0d9092cc7b594cd65f8aec72f62e8c45cf1c Add logging to compat Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/compat/Makefile.am b/compat/Makefile.am index bf79838a..ebd4e563 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -3,7 +3,8 @@ AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include noinst_LTLIBRARIES = libcompat.la libcompat_la_SOURCES = compat_uuid.c \ - compat_mman.c + compat_mman.c \ + logging.c logging.h libcompat_la_LDFLAGS = \ $(LD_NO_AS_NEEDED) diff --git a/compat/compat_mman.c b/compat/compat_mman.c index 8b874cef..58be70ae 100644 --- a/compat/compat_mman.c +++ b/compat/compat_mman.c @@ -26,6 +26,9 @@ * SOFTWARE. */ +#define BT_LOG_TAG "COMPAT-MMAN" +#include "logging.h" + #ifdef __MINGW32__ #include diff --git a/compat/compat_uuid.c b/compat/compat_uuid.c index 94511d31..e495af1c 100644 --- a/compat/compat_uuid.c +++ b/compat/compat_uuid.c @@ -22,6 +22,9 @@ * SOFTWARE. */ +#define BT_LOG_TAG "COMPAT-UUID" +#include "logging.h" + #ifdef __MINGW32__ #include diff --git a/compat/logging.c b/compat/logging.c new file mode 100644 index 00000000..b982a4b6 --- /dev/null +++ b/compat/logging.c @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2017 Michael Jeanson + * + * 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_compat_log_level +#include + +BT_LOG_INIT_LOG_LEVEL(bt_compat_log_level, "BABELTRACE_COMPAT_LOG_LEVEL"); diff --git a/compat/logging.h b/compat/logging.h new file mode 100644 index 00000000..0c2518e1 --- /dev/null +++ b/compat/logging.h @@ -0,0 +1,31 @@ +#ifndef COMPAT_LOGGING_H +#define COMPAT_LOGGING_H + +/* + * Copyright (c) 2017 Michael Jeanson + * + * 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_compat_log_level +#include + +BT_LOG_LEVEL_EXTERN_SYMBOL(bt_compat_log_level); + +#endif /* COMPAT_LOGGING_H */