------------------------------------------------------------ revno: 12384 revision-id: squid3@treenet.co.nz-20121118112141-f6aajidfaw7lmfh2 parent: squid3@treenet.co.nz-20121113070325-wj2er1yv7se5btj7 author: Francesco Chemolli committer: Amos Jeffries branch nick: 3.3 timestamp: Sun 2012-11-18 04:21:41 -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-20121118112141-f6aajidfaw7lmfh2 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 15b4366c27e3f108115d40f7426002046a121353 # timestamp: 2012-11-18 11:26:07 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20121113070325-\ # wj2er1yv7se5btj7 # # Begin patch === modified file 'src/Debug.h' --- src/Debug.h 2012-09-21 14:57:30 +0000 +++ src/Debug.h 2012-11-18 11:21:41 +0000 @@ -107,17 +107,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:13:00 +0000 +++ src/comm.cc 2012-11-18 11:21:41 +0000 @@ -2135,7 +2135,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");