From: Francesco Chemolli Date: Sat, 10 Nov 2012 18:13:37 +0000 (+0100) Subject: Modify debugs() to automatically include file, line and function name for high-detail... X-Git-Tag: SQUID_3_4_0_1~525 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bfd38d030bc42565dd84501b8be56d835b4563ab;p=thirdparty%2Fsquid.git Modify debugs() to automatically include file, line and function name for high-detail cache log lines. --- 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.