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

Go to the source code of this file.


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


#define CTX_MAX_LEVEL   255


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)


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 696 of file

Referenced by ctx_enter(), and ctx_get_descr().

Function Documentation

◆ _db_init()

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

◆ _db_print()

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

◆ _db_print_file()

static void _db_print_file ( const char *  format,
va_list  args 

Definition at line 184 of file

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

Referenced by _db_print().

◆ _db_print_stderr()

static void _db_print_stderr ( const char *  format,
va_list  args 

Definition at line 198 of file

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

Referenced by _db_print().

◆ _db_rotate_log()

void _db_rotate_log ( void  )

Definition at line 502 of file

Referenced by mainRotate().

◆ ctx_enter()

Ctx ctx_enter ( const char *  descr)

◆ ctx_exit()

void ctx_exit ( Ctx  ctx)

◆ ctx_get_descr()

static const char * ctx_get_descr ( Ctx  ctx)

Definition at line 776 of file

References Ctx_Descrs, CTX_MAX_LEVEL, and Debug::Current.

Referenced by ctx_print().

◆ ctx_print()

static void ctx_print ( void  )

◆ debugArg()

static void debugArg ( const char *  arg)

Definition at line 235 of file

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

Referenced by Debug::parseOptions().

◆ debugLogKid()

static const char * debugLogKid ( void  )

Definition at line 600 of file

References buf, and KidIdentifier.

Referenced by _db_print().

◆ debugLogTime()

static const char * debugLogTime ( void  )

Definition at line 569 of file

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

Referenced by _db_print().

◆ debugOpenLog()

static void debugOpenLog ( const char *  logfile)

◆ DebugStream()

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

References DebugFile::file().

◆ 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 866 of file

Referenced by death(), and fatal_common().

◆ ResyncDebugLog()

void ResyncDebugLog ( FILE *  newFile)

Definition at line 88 of file

References DebugFile::file_.

Referenced by ipcCreate().

◆ StopUsingDebugLog()

void StopUsingDebugLog ( )

Definition at line 82 of file

References DebugFile::clear().

Referenced by sendSignal().

◆ xassert()

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

Definition at line 613 of file

References DBG_CRITICAL, debugs, and shutting_down.

Variable Documentation

◆ Ctx_Current_Level

int Ctx_Current_Level = -1

Definition at line 708 of file

Referenced by ctx_enter(), ctx_exit(), and ctx_print().

◆ Ctx_Descrs

const char* Ctx_Descrs[CTX_MAX_LEVEL+1]

Definition at line 710 of file

Referenced by ctx_enter(), and ctx_get_descr().

◆ Ctx_Lock

int Ctx_Lock = 0

Definition at line 29 of file

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

◆ Ctx_Reported_Level

int Ctx_Reported_Level = -1

Definition at line 704 of file

Referenced by ctx_print().

◆ Ctx_Valid_Level

int Ctx_Valid_Level = -1

Definition at line 706 of file

Referenced by ctx_exit(), and ctx_print().

◆ Ctx_Warn_Level

int Ctx_Warn_Level = 32

Definition at line 702 of file

Referenced by ctx_enter().

◆ TheLog

DebugFile TheLog

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

Definition at line 74 of file






Web Site Translations