]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Modify debugs() to automatically include file, line and function name for high-detail...
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 10 Nov 2012 18:13:37 +0000 (19:13 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 10 Nov 2012 18:13:37 +0000 (19:13 +0100)
src/Debug.h

index 60c9a55dd25bc47090d5e9a4fdcc8f8f244db924..7c092e01629bc91746da655243d2460c44539807 100644 (file)
@@ -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.