This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Hoernchen gerrit-no-reply at lists.osmocom.orgHoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/26394 )
Change subject: logging: make LIBOSMOCORE_NO_LOGGING work as expected
......................................................................
logging: make LIBOSMOCORE_NO_LOGGING work as expected
The macro introduced in d02090bba538158c36fd838d4e50c47e40f11449 was not
enough: the actual logging macros are being used, i.e. by the fsm, so
wrap those as well, and provide a flag to disable this at build time.
Change-Id: Ia4c78abe5f198139f96ffa289998855be2477585
---
M configure.ac
M include/osmocom/core/logging.h
2 files changed, 19 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/94/26394/1
diff --git a/configure.ac b/configure.ac
index b36bd6f..a69f793 100644
--- a/configure.ac
+++ b/configure.ac
@@ -366,6 +366,17 @@
AC_DEFINE([PANIC_INFLOOP],[1],[Use infinite loop on panic rather than fprintf/abort])
fi
+AC_ARG_ENABLE(log_macros,
+ [AS_HELP_STRING(
+ [--disable-log-macros],
+ [Disable logging macros that are also used internally to print information]
+ )],
+ [log_macros="yes"], [log_macros="no"])
+if test x"$log_macros" == x"yes"
+then
+ AC_DEFINE([LIBOSMOCORE_NO_LOGGING],[1],[Disable logging macros])
+fi
+
AC_ARG_ENABLE(sanitize,
[AS_HELP_STRING(
[--enable-sanitize],
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index a95c478..44ff77b 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -53,11 +53,15 @@
* \param[in] fmt format string
* \param[in] args variable argument list
*/
+#ifdef DEBUG
#define LOGPC(ss, level, fmt, args...) \
do { \
if (log_check_level(ss, level)) \
logp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args); \
} while(0)
+#else
+#define LOGPC(ss, level, fmt, args...)
+#endif
/*! Log through the Osmocom logging framework with explicit source.
* If caller_file is passed as NULL, __FILE__ and __LINE__ are used
@@ -87,6 +91,7 @@
* \param[in] fmt format string
* \param[in] args variable argument list
*/
+#ifdef DEBUG
#define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...) \
do { \
if (log_check_level(ss, level)) {\
@@ -96,6 +101,9 @@
logp2(ss, level, __FILE__, __LINE__, cont, fmt, ##args); \
}\
} while(0)
+#else
+#define LOGPSRCC(ss, level, caller_file, caller_line, cont, fmt, args...)
+#endif
/*! different log levels */
#define LOGL_DEBUG 1 /*!< debugging information */
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26394
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia4c78abe5f198139f96ffa289998855be2477585
Gerrit-Change-Number: 26394
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211127/f37f5b9d/attachment.htm>