#include "squid.h"
#include "base/TextException.h"
#include "comm.h"
#include "debug/Stream.h"
#include "fatal.h"
#include "fd.h"
#include "ipc/Kids.h"
#include "time/gadgets.h"
#include "util.h"
#include <algorithm>
#include <deque>
#include <functional>
#include <memory>
#include <optional>
Go to the source code of this file.
Classes | |
class | DebugFile |
a named FILE with very-early/late usage safety mechanisms More... | |
class | DebugMessageHeader |
meta-information of a Finish()ed debugs() message More... | |
class | CompiledDebugMessage |
a fully processed debugs(), ready to be logged More... | |
class | DebugChannel |
a receiver of debugs() messages (e.g., stderr or cache.log) More... | |
class | DebugChannel::Logger |
output iterator for writing CompiledDebugMessages to a given channel More... | |
class | CacheLogChannel |
DebugChannel managing messages destined for the configured cache_log file. More... | |
class | StderrChannel |
DebugChannel managing messages destined for "standard error stream" (stderr) More... | |
class | SyslogChannel |
syslog DebugChannel More... | |
class | DebugModule |
class | LoggingSectionGuard |
Typedefs | |
using | DebugRecordCount = uint64_t |
a counter related to the number of debugs() calls More... | |
using | CompiledDebugMessageBody = std::string |
The processed "content" (i.e. the last parameter) part of a debugs() call. More... | |
using | CompiledDebugMessages = std::deque< CompiledDebugMessage > |
debugs() messages captured in LogMessage() call order More... | |
Functions | |
static const char * | debugLogTime (const timeval &) |
static void | ResetSections (const int level) |
used for the side effect: fills Debug::Levels with the given level More... | |
FILE * | DebugStream () |
static void | LabelThisProcess (const char *const name, const std::optional< int > id=std::optional< int >()) |
optimization: formats ProcessLabel once for frequent debugs() reuse More... | |
static DebugModule & | Module () |
safe access to the debugging module More... | |
void | ResyncDebugLog (FILE *newFile) |
a hack for low-level file descriptor manipulations in ipcCreate() More... | |
static void | debugArg (const char *arg) |
static void | debugOpenLog (const char *logfile) |
void | _db_rotate_log (void) |
void | xassert (const char *msg, const char *file, int line) |
std::ostream & | ForceAlert (std::ostream &s) |
Variables | |
static DebugModule * | Module_ = nullptr |
Debugging module singleton. More... | |
static std::optional< int > | ExplicitStderrLevel |
static int | DefaultStderrLevel = -1 |
static constexpr int | EarlyMessagesLevel = DBG_IMPORTANT |
early debugs() with higher level are not buffered and, hence, may be lost More... | |
static std::string | ProcessLabel |
pre-formatted name of the current process for debugs() messages (or empty) More... | |
static bool | DidResetSections = false |
static Debug::Context * | WaitingForIdle = nullptr |
static DebugFile | TheLog |
static auto | Asserting_ = false |
Typedef Documentation
◆ CompiledDebugMessageBody
using CompiledDebugMessageBody = std::string |
◆ CompiledDebugMessages
using CompiledDebugMessages = std::deque<CompiledDebugMessage> |
◆ DebugRecordCount
using DebugRecordCount = uint64_t |
Function Documentation
◆ _db_rotate_log()
void _db_rotate_log | ( | void | ) |
Definition at line 1160 of file debug.cc.
Referenced by mainRotate().
◆ debugArg()
|
static |
Definition at line 826 of file debug.cc.
References assert, Debug::Levels, MAX_DEBUG_SECTIONS, ResetSections(), and Debug::rotateNumber.
Referenced by Debug::parseOptions().
◆ debugLogTime()
|
static |
Definition at line 1227 of file debug.cc.
References assert, and Debug::Level().
Referenced by DebugChannel::writeToStream().
◆ debugOpenLog()
|
static |
Definition at line 864 of file debug.cc.
References assert, DebugModule::banCacheLogUse(), DebugFile::clear(), DBG_CRITICAL, debugs, Debug::Extra(), log(), Module(), O_TEXT, DebugFile::reset(), TheLog, DebugModule::useCacheLog(), and xstrerr().
Referenced by _db_rotate_log(), and Debug::UseCacheLog().
◆ DebugStream()
FILE* DebugStream | ( | ) |
cache.log FILE or, as the last resort, stderr stream; may be nil during static initialization and destruction!
Definition at line 355 of file debug.cc.
References DebugFile::file(), and TheLog.
Referenced by clientNegotiateSSL(), death(), dumpMallocStats(), fdDumpOpen(), ipc_thread_1(), ipcCreate(), logsFlush(), and PrintRusage().
◆ ForceAlert()
std::ostream& ForceAlert | ( | std::ostream & | s | ) |
◆ LabelThisProcess()
|
static |
Definition at line 370 of file debug.cc.
References assert, and ProcessLabel.
Referenced by Debug::NameThisHelper(), and Debug::NameThisKid().
◆ Module()
|
static |
Definition at line 501 of file debug.cc.
References Module_, and Debug::SettleSyslog().
Referenced by Debug::BanCacheLogUse(), debugOpenLog(), Debug::ForgetSaved(), Debug::LogMessage(), Debug::PrepareToDie(), Debug::SettleStderr(), Debug::SettleSyslog(), Debug::StderrEnabled(), and Debug::StopCacheLogUse().
◆ ResetSections()
|
static |
Definition at line 361 of file debug.cc.
References DidResetSections, and Debug::Levels.
Referenced by debugArg(), DebugModule::DebugModule(), and Debug::parseOptions().
◆ ResyncDebugLog()
void ResyncDebugLog | ( | FILE * | newFile | ) |
Definition at line 515 of file debug.cc.
References DebugFile::file_, and TheLog.
Referenced by ipcCreate().
◆ xassert()
void xassert | ( | const char * | msg, |
const char * | file, | ||
int | line | ||
) |
Definition at line 1260 of file debug.cc.
References Asserting_, DBG_CRITICAL, debugs, and Debug::PrepareToDie().
Variable Documentation
◆ Asserting_
|
static |
◆ DefaultStderrLevel
|
static |
ExplicitStderrLevel preference or default: Just like with ExplicitStderrLevel, debugs() messages with this (or lower) level will be written to stderr (and possibly other channels), but this setting is ignored when ExplicitStderrLevel is set. This setting is also ignored after major problems that prevent logging of important debugs() messages (e.g., failing to open cache_log or assertions).
Definition at line 53 of file debug.cc.
Referenced by StderrChannel::enabled(), and Debug::EnsureDefaultStderrLevel().
◆ DidResetSections
|
static |
Whether ResetSections() has been called already. We need to keep track of this state because external code may trigger ResetSections() before the DebugModule constructor has a chance to ResetSections() to their defaults. TODO: Find a way to static-initialize Debug::Levels instead.
Definition at line 80 of file debug.cc.
Referenced by DebugModule::DebugModule(), and ResetSections().
◆ EarlyMessagesLevel
|
staticconstexpr |
Definition at line 56 of file debug.cc.
Referenced by DebugChannel::saveMessage().
◆ ExplicitStderrLevel
|
static |
Explicitly configured maximum level for debugs() messages written to stderr. debugs() messages with this (or lower) level will be written to stderr (and possibly other channels).
Definition at line 45 of file debug.cc.
Referenced by StderrChannel::enabled(), Debug::ResetStderrLevel(), and Debug::SettleStderr().
◆ Module_
|
static |
◆ ProcessLabel
|
static |
Definition at line 59 of file debug.cc.
Referenced by LabelThisProcess(), Debug::NameThisKid(), and DebugChannel::writeToStream().
◆ TheLog
|
static |
cache_log file safe during static initialization, even if it has not been constructed yet safe during program termination, even if it has been destructed already
Definition at line 352 of file debug.cc.
Referenced by _db_rotate_log(), DebugModule::banCacheLogUse(), debugOpenLog(), DebugStream(), Debug::LogMessage(), DebugModule::prepareToDie(), ResyncDebugLog(), CacheLogChannel::shouldWrite(), Debug::StopCacheLogUse(), DebugModule::useCacheLog(), and CacheLogChannel::write().
◆ WaitingForIdle
|
static |
debugs() messages postponed due to LoggingSectionGuard::Busy(). This is the head of the invasive Context::upper FIFO list of such messages.
Definition at line 347 of file debug.cc.
Referenced by Debug::Finish(), and Debug::LogWaitingForIdle().
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products