From patchwork Thu May 12 11:15:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gerrit-no-reply@lists.osmocom.org X-Patchwork-Id: 621433 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 3r59Q43hsrz9t7V for ; Thu, 12 May 2016 21:15:24 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 067F91CB1B; Thu, 12 May 2016 11:15:23 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from 127.0.1.12 (unknown [127.0.1.12]) by lists.osmocom.org (Postfix) with ESMTPA id 766BB1CB15; Thu, 12 May 2016 11:15:22 +0000 (UTC) Date: Thu, 12 May 2016 11:15:22 +0000 From: gerrit-no-reply@lists.osmocom.org To: Harald Welte X-Gerrit-MessageType: merged Subject: Change in libosmocore[master]: logging: Use __BASE_FILE__ instead of __FILE__ X-Gerrit-Change-Id: If6d2de33c3b6bb2943954bbd81eff261dc279d58 X-Gerrit-ChangeURL: X-Gerrit-Commit: 3d79240fb41270d58f9c33508e11f0c215951cc9 In-Reply-To: References: MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/2.12.2 X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: holger@freyther.de Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" Message-Id: <20160512111523.067F91CB1B@lists.osmocom.org> From Holger Freyther : Holger Freyther has submitted this change and it was merged. Change subject: logging: Use __BASE_FILE__ instead of __FILE__ ...................................................................... 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 --- M include/osmocom/core/logging.h M include/osmocom/core/utils.h 2 files changed, 5 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 89d3f94..3da9d33 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 @@ #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 @@ #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 */ diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index dbc454f..bc39519 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -60,7 +60,7 @@ */ #define OSMO_ASSERT(exp) \ if (!(exp)) { \ - fprintf(stderr, "Assert failed %s %s:%d\n", #exp, __FILE__, __LINE__); \ + fprintf(stderr, "Assert failed %s %s:%d\n", #exp, __BASE_FILE__, __LINE__); \ osmo_generate_backtrace(); \ abort(); \ }