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.

Classes

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

Macros

#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__ << " "
 

Functions

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 30 of file Stream.h.

◆ DBG_CRITICAL

#define DBG_CRITICAL   0

critical messages always shown when they occur

Definition at line 37 of file Stream.h.

◆ DBG_DATA

#define DBG_DATA   9

output is a large data dump only necessary for advanced debugging

Definition at line 40 of file Stream.h.

◆ DBG_IMPORTANT

#define DBG_IMPORTANT   1

important messages always shown when their section is being checked

Definition at line 38 of file Stream.h.

◆ DBG_PARSE_NOTE

#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 42 of file Stream.h.

◆ debug_log

#define debug_log   DebugStream()

Definition at line 183 of file Stream.h.

◆ debugs

#define debugs (   SECTION,
  LEVEL,
  CONTENT 
)
Value:
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:75
static void Finish()
logs output buffer created in Start() and closes debugging context
Definition: debug.cc:1363
static std::ostringstream & Start(const int section, const int level)
opens debugging context and returns output buffer
Definition: debug.cc:1339
#define DBG_IMPORTANT
Definition: Stream.h:38

Definition at line 194 of file Stream.h.

◆ MAX_DEBUG_SECTIONS

#define MAX_DEBUG_SECTIONS   100

Definition at line 34 of file Stream.h.

◆ MYNAME

#define MYNAME   __FUNCTION__ << " "

Definition at line 236 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 354 of file debug.cc.

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 1408 of file debug.cc.

References Debug::ForceAlert().

Referenced by death(), and fatal_common().

◆ HERE()

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

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

His former objective is now absorbed in the debugs call itself

Definition at line 223 of file Stream.h.

◆ operator<<()

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

Definition at line 240 of file Stream.h.

◆ ResyncDebugLog()

void ResyncDebugLog ( FILE *  newDestination)

Definition at line 101 of file debug.cc.

Referenced by ipcCreate().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors