------------------------------------------------------------ revno: 11702 revision-id: squid3@treenet.co.nz-20121126082809-htkubt2799fn8gy3 parent: squid3@treenet.co.nz-20121126082604-wshgczw45e2qrsc3 author: Francesco Chemolli committer: Amos Jeffries branch nick: 3.2 timestamp: Mon 2012-11-26 01:28:09 -0700 message: Modify debugs() to automatically include file, line and function name for high-detail cache log lines. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121126082809-htkubt2799fn8gy3 # target_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # testament_sha1: ba9aca5d454ff5b72ce9eeb9a0d9c71091cc7d75 # timestamp: 2012-11-26 08:36:44 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # base_revision_id: squid3@treenet.co.nz-20121126082604-\ # wshgczw45e2qrsc3 # # Begin patch === modified file 'src/Debug.h' --- src/Debug.h 2012-07-27 03:53:06 +0000 +++ src/Debug.h 2012-11-26 08:28:09 +0000 @@ -109,17 +109,28 @@ #define debugs(SECTION, LEVEL, CONTENT) \ do { \ if ((Debug::level = (LEVEL)) <= Debug::Levels[SECTION]) { \ - Debug::getDebugOut() << CONTENT; \ - Debug::finishDebug(); \ + std::ostream &_dbo=Debug::getDebugOut(); \ + if (Debug::level > DBG_IMPORTANT) \ + _dbo << SkipBuildPrefix(__FILE__)<<"("<<__LINE__<<") "<<__FUNCTION__<<": "; \ + _dbo << CONTENT; \ + Debug::finishDebug(); \ } \ } while (/*CONSTCOND*/ 0) -/* - * HERE is a macro that you can use like this: +/** stream manipulator which does nothing. + * \deprecated Do not add to new code, and remove when editing old code * + * Its purpose is to inactivate calls made following previous debugs() + * guidelines such as * debugs(1,2, HERE << "some message"); + * + * His former objective is now absorbed in the debugs call itself */ -#define HERE SkipBuildPrefix(__FILE__)<<"("<<__LINE__<<") "<<__FUNCTION__<<": " +inline std::ostream& +HERE(std::ostream& s) +{ + return s; +} /* * MYNAME is for use at debug levels 0 and 1 where HERE is too messy. === modified file 'src/comm.cc' --- src/comm.cc 2012-11-10 04:38:32 +0000 +++ src/comm.cc 2012-11-26 08:28:09 +0000 @@ -2130,7 +2130,7 @@ return -1; } - debugs(50, 3, HERE "Opened UDS FD " << new_socket << " : family=" << AI.ai_family << ", type=" << AI.ai_socktype << ", protocol=" << AI.ai_protocol); + debugs(50, 3, "Opened UDS FD " << new_socket << " : family=" << AI.ai_family << ", type=" << AI.ai_socktype << ", protocol=" << AI.ai_protocol); /* update fdstat */ debugs(50, 5, HERE << "FD " << new_socket << " is a new socket");