[squid-dev] [PATCH] display debug levels in cache.log
Amos Jeffries
squid3 at treenet.co.nz
Fri Jul 24 23:57:16 UTC 2015
Cache.log produced at level ALL,9 are very verbose, and tracking down
what specific section,level details to log for a shorter trace without
lost details can sometimes be tricky and time consuming. Particularly
when multiple sections are involved.
This patch adds a column containing the relevant debug_options
SECTION,LEVEL value for each line right after the kidN number for debug
levels 2+.
Amos
-------------- next part --------------
=== modified file 'src/Debug.h'
--- src/Debug.h 2015-02-19 14:52:14 +0000
+++ src/Debug.h 2015-07-24 23:31:24 +0000
@@ -82,42 +82,44 @@
static OutStream *CurrentDebug;
static int TheDepth; // level of nested debugging calls
};
extern FILE *debug_log;
size_t BuildPrefixInit();
const char * SkipBuildPrefix(const char* path);
/* Debug stream
*
* Unit tests can enable full debugging to stderr for one
* debug section; to enable this, #define ENABLE_DEBUG_SECTION to the
* section number before any header
*/
#define debugs(SECTION, LEVEL, CONTENT) \
do { \
if ((Debug::level = (LEVEL)) <= Debug::Levels[SECTION]) { \
Debug::sectionLevel = Debug::Levels[SECTION]; \
std::ostream &_dbo=Debug::getDebugOut(); \
- if (Debug::level > DBG_IMPORTANT) \
- _dbo << SkipBuildPrefix(__FILE__)<<"("<<__LINE__<<") "<<__FUNCTION__<<": "; \
+ if (Debug::level > DBG_IMPORTANT) { \
+ _dbo << (SECTION) << ',' << (LEVEL) << "| " \
+ << SkipBuildPrefix(__FILE__)<<"("<<__LINE__<<") "<<__FUNCTION__<<": "; \
+ } \
_dbo << CONTENT; \
Debug::finishDebug(); \
} \
} while (/*CONSTCOND*/ 0)
/** 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
*/
inline std::ostream&
HERE(std::ostream& s)
{
return s;
}
More information about the squid-dev
mailing list