From 3d79240fb41270d58f9c33508e11f0c215951cc9 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 10 May 2016 15:23:06 +0200 Subject: logging: Use __BASE_FILE__ instead of __FILE__ Apparently __FILE__ expands to nasty '../../..' paths when BUILDDIR != SRCDIR. This in turn leads to ugly log lines like: <0000> ../../../../osmo-bts/src/common/rsl.c:1642 (bts=0,trx=0,ts=0,ss=0) Handing RLL msg UNIT_DATA_IND from LAPDm to MEAS REP Where we certainly wouldn't want the "../../../../osmo-bts" part. Change-Id: If6d2de33c3b6bb2943954bbd81eff261dc279d58 Reviewed-on: https://gerrit.osmocom.org/38 Tested-by: Jenkins Builder Reviewed-by: Harald Welte --- include/osmocom/core/logging.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/osmocom/core/logging.h') diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 89d3f948..3da9d336 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -27,13 +27,13 @@ #define DEBUGP(ss, fmt, args...) \ do { \ if (log_check_level(ss, LOGL_DEBUG)) \ - logp(ss, __FILE__, __LINE__, 0, fmt, ## args); \ + 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, __FILE__, __LINE__, 1, fmt, ## args); \ + logp(ss, __BASE_FILE__, __LINE__, 1, fmt, ## args); \ } while(0) #else @@ -56,7 +56,7 @@ void logp(int subsys, const char *file, int line, int cont, const char *format, #define LOGP(ss, level, fmt, args...) \ do { \ if (log_check_level(ss, level)) \ - logp2(ss, level, __FILE__, __LINE__, 0, fmt, ##args); \ + logp2(ss, level, __BASE_FILE__, __LINE__, 0, fmt, ##args); \ } while(0) /*! \brief Continue a log message through the Osmocom logging framework @@ -68,7 +68,7 @@ void logp(int subsys, const char *file, int line, int cont, const char *format, #define LOGPC(ss, level, fmt, args...) \ do { \ if (log_check_level(ss, level)) \ - logp2(ss, level, __FILE__, __LINE__, 1, fmt, ##args); \ + logp2(ss, level, __BASE_FILE__, __LINE__, 1, fmt, ##args); \ } while(0) /*! \brief different log levels */ -- cgit v1.2.3