From bfd38d030bc42565dd84501b8be56d835b4563ab Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Sat, 10 Nov 2012 19:13:37 +0100 Subject: [PATCH] Modify debugs() to automatically include file, line and function name for high-detail cache log lines. --- src/Debug.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Debug.h b/src/Debug.h index 60c9a55dd2..7c092e0162 100644 --- a/src/Debug.h +++ b/src/Debug.h @@ -107,8 +107,11 @@ const char * SkipBuildPrefix(const char* path); #define debugs(SECTION, LEVEL, CONTENT) \ do { \ if ((Debug::level = (LEVEL)) <= Debug::Levels[SECTION]) { \ - Debug::getDebugOut() << CONTENT; \ - Debug::finishDebug(); \ + std::ostream &_dbo=Debug::getDebugOut(); \ + if (LEVEL > DBG_IMPORTANT) \ + _dbo << SkipBuildPrefix(__FILE__)<<"("<<__LINE__<<") "<<__FUNCTION__<<": "; \ + _dbo << CONTENT; \ + Debug::finishDebug(); \ } \ } while (/*CONSTCOND*/ 0) @@ -117,7 +120,8 @@ const char * SkipBuildPrefix(const char* path); * * debugs(1,2, HERE << "some message"); */ -#define HERE SkipBuildPrefix(__FILE__)<<"("<<__LINE__<<") "<<__FUNCTION__<<": " +//TODO: just before branching Squid 3.4, blanket-remove HERE from the source +#define HERE "" /* * MYNAME is for use at debug levels 0 and 1 where HERE is too messy. -- 2.47.3