On Wed, 2003-10-22 at 18:39, Tiwari, Rajnish wrote:
[ ... debug constructs ]

We came up with this in squid3:
/* Debug stream */
#define debugs(SECTION, LEVEL, CONTENT) \
   do { \
        if ((Debug::level = (LEVEL)) <= Debug::Levels[SECTION]) { \
                Debug::getDebugOut() << CONTENT; \
                Debug::finishDebug(); \
        } \
   } while (/*CONSTCOND*/ 0)
  


used like this:
debugs(1,4, "and int " << variablename << " or other object type " <<
objectreference);

will only evaluate  Debug::getDebugOut() and the content to output when
the section 1 has it's debug level set above 3.

We have a similar construct for C - see the squid3 sources for both.

Rob
-- 
GPG key available at: <http://members.aardvark.net.au/lifeless/keys.txt>.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to