Stream.h File Reference
#include "base/Here.h"
#include "mem/AllocatorProxy.h"
#include <iostream>
#include <sstream>
#include <iomanip>
Include dependency graph for Stream.h:

Go to the source code of this file.


class  Debug
class  Debug::Context
 meta-information for debugs() or a similar debugging call More...


#define assert(EX)   ((EX)?((void)0):xassert("EX", __FILE__, __LINE__))
#define MAX_DEBUG_SECTIONS   100
#define DBG_CRITICAL   0
#define DBG_IMPORTANT   1
#define DBG_DATA   9
#define DBG_PARSE_NOTE(x)   (opt_parse_cfg_only?0:(x))
#define debug_log   DebugStream()
 change-avoidance macro; new code should call DebugStream() instead More...
#define debugs(SECTION, LEVEL, CONTENT)
#define MYNAME   __FUNCTION__ << " "


FILE * DebugStream ()
void ResyncDebugLog (FILE *newDestination)
 a hack for low-level file descriptor manipulations in ipcCreate() More...
std::ostream & ForceAlert (std::ostream &s)
std::ostream & HERE (std::ostream &s)
std::ostream & operator<< (std::ostream &os, const uint8_t d)
void _db_rotate_log (void)

Macro Definition Documentation

◆ assert

#define assert (   EX)    ((EX)?((void)0):xassert("EX", __FILE__, __LINE__))

Definition at line 33 of file Stream.h.


#define DBG_CRITICAL   0

critical messages always shown when they occur

Definition at line 40 of file Stream.h.


#define DBG_DATA   9

output is a large data dump only necessary for advanced debugging

Definition at line 43 of file Stream.h.


#define DBG_IMPORTANT   1

important messages always shown when their section is being checked

Definition at line 41 of file Stream.h.


#define DBG_PARSE_NOTE (   x)    (opt_parse_cfg_only?0:(x))

output is always to be displayed on '-k parse' but at level-x normally.

Definition at line 45 of file Stream.h.

◆ debug_log

#define debug_log   DebugStream()

Definition at line 185 of file Stream.h.

◆ debugs

#define debugs (   SECTION,
do { \
const int _dbg_level = (LEVEL); \
if (Debug::Enabled((SECTION), _dbg_level)) { \
std::ostream &_dbo = Debug::Start((SECTION), _dbg_level); \
if (_dbg_level > DBG_IMPORTANT) { \
_dbo << (SECTION) << ',' << _dbg_level << "| " \
<< Here() << ": "; \
} \
_dbo << CONTENT; \
} \
} while (/*CONSTCOND*/ 0)
#define Here()
source code location of the caller
Definition: Here.h:15
static bool Enabled(const int section, const int level)
whether debugging the given section and the given level produces output
Definition: Stream.h:79
static void Finish()
logs output buffer created in Start() and closes debugging context
static std::ostringstream & Start(const int section, const int level)
opens debugging context and returns output buffer
Definition: Stream.h:41

Definition at line 196 of file Stream.h.


#define MAX_DEBUG_SECTIONS   100

Definition at line 37 of file Stream.h.


#define MYNAME   __FUNCTION__ << " "

Definition at line 238 of file Stream.h.

Function Documentation

◆ _db_rotate_log()

void _db_rotate_log ( void  )

◆ DebugStream()

FILE* DebugStream ( )

cache.log FILE or, as the last resort, stderr stream; may be nil during static initialization and destruction!

Definition at line 353 of file

References DebugFile::file(), and TheLog.

◆ ForceAlert()

std::ostream& ForceAlert ( std::ostream &  s)

Does not change the stream being manipulated. Exists for its side effect: In a debugs() context, forces the message to become a syslog ALERT. Outside of debugs() context, has no effect and should not be used.

Definition at line 1396 of file

References Debug::ForceAlert().

Referenced by death(), and fatal_common().

◆ HERE()

std::ostream& HERE ( std::ostream &  s)

stream manipulator which does nothing.

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, "some message");

His former objective is now absorbed in the debugs call itself

Definition at line 225 of file Stream.h.

◆ operator<<()

std::ostream& operator<< ( std::ostream &  os,
const uint8_t  d 

Definition at line 242 of file Stream.h.

◆ ResyncDebugLog()

void ResyncDebugLog ( FILE *  newDestination)

Definition at line 100 of file

Referenced by ipcCreate().






Web Site Translations