#include <Stream.h>

Classes | |
class | Context |
meta-information for debugs() or a similar debugging call More... | |
Static Public Member Functions | |
static bool | Enabled (const int section, const int level) |
whether debugging the given section and the given level produces output More... | |
static void | NameThisHelper (const char *name) |
static void | NameThisKid (int kidIdentifier) |
static void | parseOptions (char const *) |
static int | Level () |
minimum level required by the current debugs() call More... | |
static int | SectionLevel () |
maximum level currently allowed More... | |
static std::ostringstream & | Start (const int section, const int level) |
opens debugging context and returns output buffer More... | |
static void | Finish () |
logs output buffer created in Start() and closes debugging context More... | |
static void | ForceAlert () |
configures the active debugging context to write syslog ALERT More... | |
static std::ostream & | Extra (std::ostream &os) |
prefixes each grouped debugs() line after the first one in the group More... | |
static void | ForgetSaved () |
silently erases saved early debugs() messages (if any) More... | |
static void | PrepareToDie () |
static void | LogWaitingForIdle () |
Logs messages of Finish()ed debugs() calls that were queued earlier. More... | |
static void | BanCacheLogUse () |
static void | UseCacheLog () |
static void | StopCacheLogUse () |
static void | EnsureDefaultStderrLevel (int maxDefault) |
static void | ResetStderrLevel (int maxLevel) |
static void | SettleStderr () |
static bool | StderrEnabled () |
static void | ConfigureSyslog (const char *facility) |
enables logging to syslog (using the specified facility, when not nil) More... | |
static void | SettleSyslog () |
Static Public Attributes | |
static char * | debugOptions = nullptr |
static char * | cache_log = nullptr |
static int | rotateNumber = -1 |
static int | Levels [MAX_DEBUG_SECTIONS] |
static int | override_X = 0 |
static bool | log_syslog = false |
Static Private Member Functions | |
static void | LogMessage (const Context &) |
broadcasts debugs() message to the logging channels More... | |
Static Private Attributes | |
static Context * | Current = nullptr |
deepest active context; nil outside debugs() More... | |
Detailed Description
Member Function Documentation
◆ BanCacheLogUse()
|
static |
Starts using stderr as a cache_log file replacement. Also applies configured debug_options (if any). Call this or UseCacheLog() to stop early message accumulation.
Definition at line 1114 of file debug.cc.
References DebugModule::banCacheLogUse(), debugOptions, Module(), and parseOptions().
Referenced by ConfigureDebugging(), mainHandleCommandLineOption(), NameThisHelper(), and IcmpPinger::Open().
◆ ConfigureSyslog()
|
static |
Definition at line 1079 of file debug.cc.
References fatalf().
Referenced by mainHandleCommandLineOption().
◆ Enabled()
Definition at line 76 of file Stream.h.
References DebugMessageHeader::level, Levels, and DebugMessageHeader::section.
Referenced by clientNegotiateSSL(), Ftp::Server::handleRequest(), Adaptation::Ecap::Host::openDebug(), DebugChannel::Logger::operator=(), Security::NegotiationHistory::retrieveNegotiatedInfo(), and Security::PeerConnector::sslCrtvdHandleReply().
◆ EnsureDefaultStderrLevel()
|
static |
In the absence of ResetStderrLevel() calls, future debugs() with the given (or lower) level will be written to stderr (at least). If called many times, the highest parameter wins. ResetStderrLevel() overwrites this default-setting method, regardless of the calls order.
Definition at line 691 of file debug.cc.
References DefaultStderrLevel.
Referenced by mainHandleCommandLineOption(), and NameThisHelper().
◆ Extra()
|
inlinestatic |
Definition at line 114 of file Stream.h.
Referenced by RegexPattern::RegexPattern(), Store::SwapMetaUnpacker::SwapMetaUnpacker(), Comm::TcpAcceptor::acceptOne(), Helper::Reply::CheckReceivedKey(), Store::CheckSwapMetaUrl(), clientHttpConnectionsOpen(), clientListenerConnectionOpened(), debugOpenLog(), AccessLogEntry::detailCodeContext(), AnyP::PortCfg::detailCodeContext(), Comm::Connection::detailCodeContext(), htcpSpecifier::detailCodeContext(), Security::PeerConnector::handleNegotiationResult(), Ssl::CertValidationHelper::Init(), Security::IssuedBy(), ConnStateData::lifetimeTimeout(), Security::KeyData::loadCertificates(), neighbors_init(), operator<<(), ACLRegexData::parse(), FormattedLog::parseOptions(), Ssl::CertValidationMsg::parseResponse(), TextException::print(), processNewRequest(), Rock::Rebuild::progressDescription(), Ssl::readCertAndPrivateKeyFromMemory(), Ipc::Port::receiveOrIgnore(), Ipc::QuestionerId::rejectAnswerIfStale(), Ssl::ReportAndForgetErrors(), Acl::SetKey(), setTraceability(), storeCleanup(), storeRebuildComplete(), TestRandomUuid::testInvalidIds(), and testCacheManager::testParseUrl().
◆ Finish()
|
static |
Definition at line 1352 of file debug.cc.
References Debug::Context::buf, Current, CurrentCodeContextDetail(), DBG_IMPORTANT, Debug::Context::forceAlert, last, Debug::Context::level, LogMessage(), Debug::Context::upper, WaitingForIdle, and Debug::Context::waitingForIdle.
Referenced by Adaptation::Ecap::Host::closeDebug().
◆ ForceAlert()
|
static |
Definition at line 1389 of file debug.cc.
References Current, and Debug::Context::forceAlert.
Referenced by ForceAlert().
◆ ForgetSaved()
|
static |
◆ Level()
|
inlinestatic |
Definition at line 101 of file Stream.h.
References Current, and Debug::Context::level.
Referenced by debugLogTime().
◆ LogMessage()
|
staticprivate |
Definition at line 777 of file debug.cc.
References Debug::Context::buf, dbg_mutex, DebugFile::file(), DebugModule::log(), Module(), NULL, TheLog, and xcalloc().
Referenced by Finish(), and LogWaitingForIdle().
◆ LogWaitingForIdle()
|
static |
Definition at line 1313 of file debug.cc.
References assert, LogMessage(), Debug::Context::upper, and WaitingForIdle.
Referenced by LoggingSectionGuard::~LoggingSectionGuard(), and DebugModule::prepareToDie().
◆ NameThisHelper()
|
static |
Use the given name for debugs() messages from this helper process. Side effect: Commits to using helper-appropriate debug levels/channels.
- See also
- NameThisKid()
Definition at line 382 of file debug.cc.
References assert, BanCacheLogUse(), DBG_DATA, debugOptions, debugs, EnsureDefaultStderrLevel(), LabelThisProcess(), SettleStderr(), SettleSyslog(), and xstrdup.
Referenced by main().
◆ NameThisKid()
|
static |
Use the given ID for debugs() messages from this SMP kid process.
- See also
- NameThisHelper()
Definition at line 405 of file debug.cc.
References LabelThisProcess(), and ProcessLabel.
Referenced by ConfigureCurrentKid().
◆ parseOptions()
|
static |
Definition at line 1091 of file debug.cc.
References debugArg(), debugs, override_X, ResetSections(), w_space, xfree, and xstrdup.
Referenced by BanCacheLogUse(), mainHandleCommandLineOption(), sigusr2_handle(), and UseCacheLog().
◆ PrepareToDie()
|
static |
Reacts to ongoing program termination (e.g., flushes buffered messages). Call this before logging the termination reason to maximize the chances of that valuable debugs() getting through to the admin.
Definition at line 561 of file debug.cc.
References Module(), and DebugModule::prepareToDie().
Referenced by DebugModule::DebugModule(), death(), fatal_dump(), OnTerminate(), and xassert().
◆ ResetStderrLevel()
|
static |
Future debugs() messages with the given (or lower) level will be written to stderr (at least). If called many times, the last call wins.
Definition at line 699 of file debug.cc.
References ExplicitStderrLevel.
Referenced by mainHandleCommandLineOption().
◆ SectionLevel()
|
inlinestatic |
Definition at line 103 of file Stream.h.
References Current, and Debug::Context::sectionLevel.
Referenced by Raw::print().
◆ SettleStderr()
|
static |
Finalizes stderr configuration when no (more) ResetStderrLevel() and EnsureDefaultStderrLevel() calls are expected.
Definition at line 705 of file debug.cc.
References DBG_CRITICAL, DBG_DATA, debugs, ExplicitStderrLevel, Module(), override_X, DebugModule::stderrChannel, and DebugChannel::stopEarlyMessageCollection().
Referenced by NameThisHelper(), and SquidMain().
◆ SettleSyslog()
|
static |
Finalizes syslog configuration when no (more) ConfigureSyslog() calls are expected.
Definition at line 1141 of file debug.cc.
References APP_SHORTNAME, log_syslog, SyslogChannel::markOpened(), Module(), DebugChannel::stopEarlyMessageCollection(), and DebugModule::syslogChannel.
Referenced by Module(), NameThisHelper(), and SquidMain().
◆ Start()
Definition at line 1328 of file debug.cc.
References Debug::Context::buf, LoggingSectionGuard::Busy(), Current, Debug::Context::rewind(), and Debug::Context::waitingForIdle.
Referenced by Adaptation::Ecap::Host::openDebug().
◆ StderrEnabled()
|
static |
Whether at least some debugs() messages may be written to stderr. The answer may be affected by BanCacheLogUse() and SettleStderr().
Definition at line 725 of file debug.cc.
References DBG_CRITICAL, StderrChannel::enabled(), Module(), and DebugModule::stderrChannel.
Referenced by watch_child().
◆ StopCacheLogUse()
|
static |
Closes and stops using cache_log (if it was open). Starts using stderr as a cache_log file replacement.
Definition at line 1128 of file debug.cc.
References DebugModule::banCacheLogUse(), DebugModule::cacheLogChannel, DebugFile::clear(), DebugFile::file(), Module(), DebugChannel::stopEarlyMessageCollection(), and TheLog.
Referenced by RemoveInstance().
◆ UseCacheLog()
|
static |
Opens and starts using the configured cache_log file. Also applies configured debug_options (if any). Call this or BanCacheLogUse() to stop early message accumulation.
Definition at line 1121 of file debug.cc.
References cache_log, debugOpenLog(), debugOptions, and parseOptions().
Referenced by ConfigureDebugging(), and mainReconfigureFinish().
Member Data Documentation
◆ cache_log
|
static |
Definition at line 82 of file Stream.h.
Referenced by _db_rotate_log(), DebugFile::reset(), and UseCacheLog().
◆ Current
|
staticprivate |
Definition at line 175 of file Stream.h.
Referenced by Finish(), ForceAlert(), Level(), Debug::Context::rewind(), SectionLevel(), and Start().
◆ debugOptions
|
static |
Definition at line 81 of file Stream.h.
Referenced by BanCacheLogUse(), NameThisHelper(), IcmpPinger::Open(), PutEnvironment(), sigusr2_handle(), snmp_confFn(), and UseCacheLog().
◆ Levels
|
static |
Definition at line 84 of file Stream.h.
Referenced by testAuthConfig::create(), debugArg(), Enabled(), main(), ResetSections(), Debug::Context::rewind(), and testAuthUserRequest::scheme().
◆ log_syslog
|
static |
Definition at line 86 of file Stream.h.
Referenced by SettleSyslog(), and SyslogChannel::shouldWrite().
◆ override_X
|
static |
Definition at line 85 of file Stream.h.
Referenced by mainHandleCommandLineOption(), parseOptions(), and SettleStderr().
◆ rotateNumber
|
static |
Definition at line 83 of file Stream.h.
Referenced by _db_rotate_log(), configDoConfigure(), and debugArg().
The documentation for this class was generated from the following files:
- src/debug/Stream.h
- src/debug/debug.cc
- src/tests/stub_debug.cc