debug.cc File Reference
#include "squid.h"
#include "base/TextException.h"
#include "Debug.h"
#include "DebugMessages.h"
#include "fd.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...
 

Functions

static const char * debugLogTime (void)
 
static const char * debugLogKid (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_set_syslog (const char *)
 
void _db_init (const char *logfile, const char *options)
 
void _db_rotate_log (void)
 
void xassert (const char *msg, const char *file, int line)
 
std::ostream & ForceAlert (std::ostream &s)
 
void PrintHex (std::ostream &os, const char *data, const size_t n)
 Prints the first n data bytes using hex notation. Does nothing if n is 0. More...
 

Variables

DebugMessages TheDebugMessages
 
static DebugFile TheLog
 

Function Documentation

◆ _db_init()

void _db_init ( const char *  logfile,
const char *  options 
)

Definition at line 493 of file debug.cc.

Referenced by ConfigureDebugging(), main(), mainReconfigureFinish(), and IcmpPinger::Open().

◆ _db_print()

static void _db_print ( const bool  forceAlert,
const char *  format,
  ... 
)
static

◆ _db_print_file()

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

Definition at line 189 of file debug.cc.

References debug_log, and NULL.

Referenced by _db_print().

◆ _db_print_stderr()

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

Definition at line 199 of file debug.cc.

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

Referenced by _db_print().

◆ _db_rotate_log()

void _db_rotate_log ( void  )

Definition at line 511 of file debug.cc.

Referenced by mainRotate().

◆ _db_set_syslog()

void _db_set_syslog ( const char *  )

Definition at line 460 of file debug.cc.

Referenced by mainHandleCommandLineOption().

◆ debugArg()

static void debugArg ( const char *  arg)
static

Definition at line 236 of file debug.cc.

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

Referenced by Debug::parseOptions().

◆ debugLogKid()

static const char * debugLogKid ( void  )
static

Definition at line 609 of file debug.cc.

References KidIdentifier.

Referenced by _db_print().

◆ debugLogTime()

static const char * debugLogTime ( void  )
static

Definition at line 578 of file debug.cc.

References assert, current_time, getCurrentTime(), Debug::Level(), and sz.

Referenced by _db_print().

◆ debugOpenLog()

static void debugOpenLog ( const char *  logfile)
static

Definition at line 276 of file debug.cc.

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

Referenced by _db_init(), and _db_rotate_log().

◆ DebugStream()

FILE* DebugStream ( )

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

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

Referenced by death(), and fatal_common().

◆ PrintHex()

void PrintHex ( std::ostream &  os,
const char *  data,
const size_t  n 
)

Definition at line 724 of file debug.cc.

References assert, and for_each().

Referenced by Raw::print(), and PrintSecret().

◆ ResyncDebugLog()

void ResyncDebugLog ( FILE *  newFile)

Definition at line 90 of file debug.cc.

References DebugFile::file_, and TheLog.

Referenced by ipcCreate().

◆ StopUsingDebugLog()

void StopUsingDebugLog ( )

Definition at line 84 of file debug.cc.

References DebugFile::clear(), and TheLog.

Referenced by sendSignal().

◆ xassert()

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

Definition at line 622 of file debug.cc.

References DBG_CRITICAL, debugs, and shutting_down.

Variable Documentation

◆ TheDebugMessages

DebugMessages TheDebugMessages

Definition at line 32 of file debug.cc.

◆ TheLog

DebugFile TheLog
static

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

Definition at line 76 of file debug.cc.

Referenced by _db_rotate_log(), debugOpenLog(), DebugStream(), ResyncDebugLog(), and StopUsingDebugLog().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors