debug.cc File Reference
#include "squid.h"
#include "Debug.h"
#include "ipc/Kids.h"
#include "SquidTime.h"
#include "util.h"
#include <algorithm>
#include "globals.h"
Include dependency graph for debug.cc:

Go to the source code of this file.

Classes

class  DebugFile
 a (FILE*, file name) pair that uses stderr FILE as the last resort More...
 

Macros

#define CTX_MAX_LEVEL   255
 

Functions

static const char * debugLogTime (void)
 
static const char * debugLogKid (void)
 
static void ctx_print (void)
 
static void _db_print_stderr (const char *format, va_list args)
 
static void _db_print_file (const char *format, va_list args)
 
FILE * DebugStream ()
 
void StopUsingDebugLog ()
 start logging to stderr (instead of cache.log, if any) More...
 
void ResyncDebugLog (FILE *newFile)
 a hack for low-level file descriptor manipulations in ipcCreate() More...
 
static void _db_print (const bool forceAlert, const char *format,...)
 
static void debugArg (const char *arg)
 
static void debugOpenLog (const char *logfile)
 
void _db_init (const char *logfile, const char *options)
 
void _db_rotate_log (void)
 
void xassert (const char *msg, const char *file, int line)
 
static const char * ctx_get_descr (Ctx ctx)
 
Ctx ctx_enter (const char *descr)
 
void ctx_exit (Ctx ctx)
 
std::ostream & ForceAlert (std::ostream &s)
 

Variables

static int Ctx_Lock = 0
 
static DebugFile TheLog
 
static int Ctx_Warn_Level = 32
 
static int Ctx_Reported_Level = -1
 
static int Ctx_Valid_Level = -1
 
static int Ctx_Current_Level = -1
 
static const char * Ctx_Descrs [CTX_MAX_LEVEL+1]
 

Macro Definition Documentation

#define CTX_MAX_LEVEL   255

Definition at line 692 of file debug.cc.

Referenced by ctx_enter(), and ctx_get_descr().

Function Documentation

void _db_init ( const char *  logfile,
const char *  options 
)
static void _db_print ( const bool  forceAlert,
const char *  format,
  ... 
)
static
static void _db_print_file ( const char *  format,
va_list  args 
)
static

Definition at line 184 of file debug.cc.

References Ctx_Lock, ctx_print(), debug_log, and NULL.

Referenced by _db_print().

static void _db_print_stderr ( const char *  format,
va_list  args 
)
static

Definition at line 198 of file debug.cc.

References debug_log, Debug::Level(), and Debug::log_stderr.

Referenced by _db_print().

void _db_rotate_log ( void  )

Definition at line 502 of file debug.cc.

Referenced by mainRotate().

Ctx ctx_enter ( const char *  descr)
void ctx_exit ( Ctx  ctx)
static const char * ctx_get_descr ( Ctx  ctx)
static

Definition at line 772 of file debug.cc.

References CTX_MAX_LEVEL.

Referenced by ctx_print().

static void ctx_print ( void  )
static

Definition at line 741 of file debug.cc.

References _db_print(), ctx_get_descr(), Ctx_Lock, Ctx_Reported_Level, and Ctx_Valid_Level.

Referenced by _db_print(), and _db_print_file().

static void debugArg ( const char *  arg)
static

Definition at line 235 of file debug.cc.

References assert, i, Debug::Levels, MAX_DEBUG_SECTIONS, and Debug::rotateNumber.

Referenced by Debug::parseOptions().

static const char * debugLogKid ( void  )
static

Definition at line 596 of file debug.cc.

References buf, and KidIdentifier.

Referenced by _db_print().

static const char * debugLogTime ( void  )
static

Definition at line 569 of file debug.cc.

References buf, current_time, getCurrentTime(), and Debug::Level().

Referenced by _db_print().

static void debugOpenLog ( const char *  logfile)
static

Definition at line 275 of file debug.cc.

References DebugFile::clear(), log(), logfile, NULL, O_TEXT, and DebugFile::reset().

Referenced by _db_init(), and _db_rotate_log().

FILE* DebugStream ( )

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

Definition at line 77 of file debug.cc.

References DebugFile::file().

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

Referenced by death(), and fatal_common().

void ResyncDebugLog ( FILE *  newFile)

Definition at line 88 of file debug.cc.

References DebugFile::file_.

Referenced by ipcCreate().

void StopUsingDebugLog ( )

Definition at line 82 of file debug.cc.

References DebugFile::clear().

Referenced by sendSignal().

void xassert ( const char *  msg,
const char *  file,
int  line 
)

Definition at line 609 of file debug.cc.

References DBG_CRITICAL, debugs, and shutting_down.

Variable Documentation

int Ctx_Current_Level = -1
static

Definition at line 704 of file debug.cc.

Referenced by ctx_enter(), and ctx_exit().

const char* Ctx_Descrs[CTX_MAX_LEVEL+1]
static

Definition at line 706 of file debug.cc.

int Ctx_Lock = 0
static

Definition at line 29 of file debug.cc.

Referenced by _db_print(), _db_print_file(), and ctx_print().

int Ctx_Reported_Level = -1
static

Definition at line 700 of file debug.cc.

Referenced by ctx_print().

int Ctx_Valid_Level = -1
static

Definition at line 702 of file debug.cc.

Referenced by ctx_print().

int Ctx_Warn_Level = 32
static

Definition at line 698 of file debug.cc.

DebugFile TheLog
static

configured cache.log file or stderr safe during static initialization, even if it has not been constructed yet

Definition at line 74 of file debug.cc.

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors