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/.
Max gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/1580 logging: remove code duplication * make DEBUGP* macro into simple wrappers around LOGP* * remove unused logp() function Related: OS#71 Change-Id: Ia6c92bd4824c44fc22cc733ce7a88da86e58ed93 --- M TODO-RELEASE M include/osmocom/core/logging.h M src/logging.c 3 files changed, 28 insertions(+), 56 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/80/1580/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index fb0bfea..429fdda 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,4 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmocore API/ABI change remove unused logp() function diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index fe9ae93..910d5ab 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -17,46 +17,6 @@ /*! \brief Maximum number of logging filters */ #define LOG_MAX_FILTERS 8 -#define DEBUG - -#ifdef DEBUG -/*! \brief Log a debug message through the Osmocom logging framework - * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) - * \param[in] fmt format string - * \param[in] args variable argument list - */ -#define DEBUGP(ss, fmt, args...) \ - do { \ - if (log_check_level(ss, LOGL_DEBUG)) \ - logp(ss, __BASE_FILE__, __LINE__, 0, fmt, ## args); \ - } while(0) - -#define DEBUGPC(ss, fmt, args...) \ - do { \ - if (log_check_level(ss, LOGL_DEBUG)) \ - logp(ss, __BASE_FILE__, __LINE__, 1, fmt, ## args); \ - } while(0) - -#else -#define DEBUGP(xss, fmt, args...) -#define DEBUGPC(ss, fmt, args...) -#endif - - -void osmo_vlogp(int subsys, int level, const char *file, int line, - int cont, const char *format, va_list ap); - -void logp(int subsys, const char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6))); - -/*! \brief Log a new message through the Osmocom logging framework - * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) - * \param[in] level logging level (e.g. \ref LOGL_NOTICE) - * \param[in] fmt format string - * \param[in] args variable argument list - */ -#define LOGP(ss, level, fmt, args...) \ - LOGPSRC(ss, level, NULL, 0, fmt, ## args) - /*! \brief Continue a log message through the Osmocom logging framework * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) * \param[in] level logging level (e.g. \ref LOGL_NOTICE) @@ -68,6 +28,15 @@ if (log_check_level(ss, level)) \ logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \ } while(0) + +/*! \brief Log a new message through the Osmocom logging framework + * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) + * \param[in] level logging level (e.g. \ref LOGL_NOTICE) + * \param[in] fmt format string + * \param[in] args variable argument list + */ +#define LOGP(ss, level, fmt, args...) \ + LOGPSRC(ss, level, NULL, 0, fmt, ## args) /*! \brief Log through the Osmocom logging framework with explicit source. * If caller_file is passed as NULL, __BASE_FILE__ and __LINE__ are used @@ -91,6 +60,24 @@ }\ } while(0) +#define DEBUG + +#ifdef DEBUG +/*! \brief Log a debug message through the Osmocom logging framework + * \param[in] ss logging subsystem (e.g. \ref DLGLOBAL) + * \param[in] fmt format string + * \param[in] args variable argument list + */ +#define DEBUGP(ss, fmt, args...) LOGP(ss, LOGL_DEBUG, fmt, ##args) +#define DEBUGPC(ss, fmt, args...) LOGPC(ss, LOGL_DEBUG, fmt, ##args) +#else +#define DEBUGP(xss, fmt, args...) +#define DEBUGPC(ss, fmt, args...) +#endif + +void osmo_vlogp(int subsys, int level, const char *file, int line, + int cont, const char *format, va_list ap); + /*! \brief different log levels */ #define LOGL_DEBUG 1 /*!< \brief debugging information */ #define LOGL_INFO 3 /*!< \brief general information */ diff --git a/src/logging.c b/src/logging.c index b0bca54..e901b8a 100644 --- a/src/logging.c +++ b/src/logging.c @@ -417,22 +417,6 @@ } } -/*! \brief logging function used by DEBUGP() macro - * \param[in] subsys Logging sub-system - * \param[in] file name of source code file - * \param[in] cont continuation (1) or new line (0) - * \param[in] format format string - */ -void logp(int subsys, const char *file, int line, int cont, - const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - osmo_vlogp(subsys, LOGL_DEBUG, file, line, cont, format, ap); - va_end(ap); -} - /*! \brief logging function used by LOGP() macro * \param[in] subsys Logging sub-system * \param[in] level Log level -- To view, visit https://gerrit.osmocom.org/1580 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia6c92bd4824c44fc22cc733ce7a88da86e58ed93 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de>