11#ifndef SQUID_SRC_DEBUG_STREAM_H
12#define SQUID_SRC_DEBUG_STREAM_H
26#define assert(EX) ((void)0)
28#define assert(EX) ((void)0)
30#define assert(EX) ((EX)?((void)0):xassert( # EX , __FILE__, __LINE__))
34#define MAX_DEBUG_SECTIONS 100
38#define DBG_IMPORTANT 1
42#define DBG_PARSE_NOTE(x) (opt_parse_cfg_only?0:(x))
54 Context(
const int aSectionLevel,
const int aLevel);
64 void rewind(
const int aSection,
const int aLevel);
66 std::ostringstream
buf;
75 static bool Enabled(
const int section,
const int level)
105 static std::ostringstream &
Start(
const int section,
const int level);
114 static std::ostream&
Extra(std::ostream &);
192#define debugs(SECTION, LEVEL, CONTENT) \
194 const int _dbg_level = (LEVEL); \
195 if (Debug::Enabled((SECTION), _dbg_level)) { \
196 std::ostream &_dbo = Debug::Start((SECTION), _dbg_level); \
197 if (_dbg_level > DBG_IMPORTANT) { \
198 _dbo << (SECTION) << ',' << _dbg_level << "| " \
216#ifdef __PRETTY_FUNCTION__
217#define MYNAME __PRETTY_FUNCTION__ << " "
219#define MYNAME __func__ << " "
223inline std::ostream&
operator <<(std::ostream &os,
const uint8_t d)
225 return (os << (
int)d);
meta-information for debugs() or a similar debugging call
int section
the debug section of the debugs() call
Context * upper
previous or parent record in nested debugging calls
int sectionLevel
maximum debugging level allowed during the call
std::ostringstream buf
debugs() output sink
int level
minimum debugging level required by the debugs() call
bool forceAlert
the current debugs() will be a syslog ALERT
void rewind(const int aSection, const int aLevel)
Optimization: avoids new Context creation for every debugs().
static void ResetStderrLevel(int maxLevel)
static bool StderrEnabled()
static void parseOptions(char const *)
static void PrepareToDie()
static void ForgetSaved()
silently erases saved early debugs() messages (if any)
static bool Enabled(const int section, const int level)
whether debugging the given section and the given level produces output
static Context * Current
deepest active context; nil outside debugs()
static std::ostream & Extra(std::ostream &)
static void NameThisKid(int kidIdentifier)
static int SectionLevel()
maximum level currently allowed
static void LogMessage(const Context &)
broadcasts debugs() message to the logging channels
static void SettleSyslog()
static int Levels[MAX_DEBUG_SECTIONS]
static void Finish()
logs output buffer created in Start() and closes debugging context
static void NameThisHelper(const char *name)
static char * debugOptions
static void UseCacheLog()
static void FormatStream(std::ostream &)
configures default formatting for the debugging stream
static std::ostringstream & Start(const int section, const int level)
opens debugging context and returns output buffer
static void BanCacheLogUse()
static void ConfigureSyslog(const char *facility)
enables logging to syslog (using the specified facility, when not nil)
static void StopCacheLogUse()
static int Level()
minimum level required by the current debugs() call
static void EnsureDefaultStderrLevel(int maxDefault)
static void SettleStderr()
static void LogWaitingForIdle()
Logs messages of Finish()ed debugs() calls that were queued earlier.
static void ForceAlert()
configures the active debugging context to write syslog ALERT
void ResyncDebugLog(FILE *newDestination)
a hack for low-level file descriptor manipulations in ipcCreate()
#define MAX_DEBUG_SECTIONS
void _db_rotate_log(void)
std::ostream & operator<<(std::ostream &os, const uint8_t d)
std::ostream & ForceAlert(std::ostream &s)