#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 &) |
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 | FormatStream (std::ostream &) |
configures default formatting for the debugging stream More... | |
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 1115 of file debug.cc.
References DebugModule::banCacheLogUse(), debugOptions, Module(), and parseOptions().
Referenced by ConfigureDebugging(), mainHandleCommandLineOption(), NameThisHelper(), and IcmpPinger::Open().
◆ ConfigureSyslog()
|
static |
Definition at line 1080 of file debug.cc.
References fatalf().
Referenced by mainHandleCommandLineOption().
◆ Enabled()
Definition at line 75 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 692 of file debug.cc.
References DefaultStderrLevel.
Referenced by mainHandleCommandLineOption(), and NameThisHelper().
◆ Extra()
|
static |
Prefixes each grouped debugs() line after the first one in the group. Resets debugging stream format to the initial/default one.
Definition at line 1313 of file debug.cc.
References FormatStream().
Referenced by RegexPattern::RegexPattern(), Store::SwapMetaUnpacker::SwapMetaUnpacker(), Comm::TcpAcceptor::acceptOne(), Helper::Reply::CheckReceivedKey(), Store::CheckSwapMetaUrl(), clientHttpConnectionsOpen(), clientListenerConnectionOpened(), CurrentExceptionExtra(), debugOpenLog(), AccessLogEntry::detailCodeContext(), AnyP::PortCfg::detailCodeContext(), Comm::Connection::detailCodeContext(), htcpSpecifier::detailCodeContext(), MemStore::get(), Helper::Client::handleFewerServers(), Security::PeerConnector::handleNegotiationResult(), Ssl::CertValidationHelper::Init(), Security::IssuedBy(), ConnStateData::lifetimeTimeout(), Security::KeyData::loadCertificates(), neighborIgnoreNonPeer(), neighbors_init(), operator<<(), ACLRegexData::parse(), store_client::parseHttpHeadersFromDisk(), FormattedLog::parseOptions(), Ssl::CertValidationMsg::parseResponse(), HttpReply::parseTerminatedPrefix(), TextException::print(), processNewRequest(), Rock::Rebuild::progressDescription(), Ssl::readCertAndPrivateKeyFromMemory(), Ipc::Port::receiveOrIgnore(), Ipc::QuestionerId::rejectAnswerIfStale(), Ssl::ReportAndForgetErrors(), Acl::SetKey(), setTraceability(), storeCleanup(), storeRebuildComplete(), TestRandomUuid::testInvalidIds(), CacheManagerInternals::testInvalidUrl(), and CacheManagerInternals::testValidUrl().
◆ Finish()
|
static |
Definition at line 1363 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 1400 of file debug.cc.
References Current, and Debug::Context::forceAlert.
Referenced by ForceAlert().
◆ ForgetSaved()
|
static |
◆ FormatStream()
|
staticprivate |
Definition at line 1302 of file debug.cc.
Referenced by Debug::Context::Context(), Extra(), and Debug::Context::rewind().
◆ Level()
|
inlinestatic |
Definition at line 100 of file Stream.h.
References Current, and Debug::Context::level.
Referenced by debugLogTime().
◆ LogMessage()
|
staticprivate |
Definition at line 778 of file debug.cc.
References Debug::Context::buf, dbg_mutex, DebugFile::file(), DebugModule::log(), Module(), TheLog, and xcalloc().
Referenced by Finish(), and LogWaitingForIdle().
◆ LogWaitingForIdle()
|
static |
Definition at line 1324 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 383 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 406 of file debug.cc.
References LabelThisProcess(), and ProcessLabel.
Referenced by ConfigureCurrentKid().
◆ parseOptions()
|
static |
Definition at line 1092 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 562 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 700 of file debug.cc.
References ExplicitStderrLevel.
Referenced by mainHandleCommandLineOption().
◆ SectionLevel()
|
inlinestatic |
Definition at line 102 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 706 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 1142 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 1339 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 726 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 1129 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 1122 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 81 of file Stream.h.
Referenced by _db_rotate_log(), DebugFile::reset(), and UseCacheLog().
◆ Current
|
staticprivate |
Definition at line 176 of file Stream.h.
Referenced by Finish(), ForceAlert(), Level(), Debug::Context::rewind(), SectionLevel(), and Start().
◆ debugOptions
|
static |
Definition at line 80 of file Stream.h.
Referenced by BanCacheLogUse(), NameThisHelper(), IcmpPinger::Open(), PutEnvironment(), sigusr2_handle(), snmp_confFn(), and UseCacheLog().
◆ Levels
|
static |
Definition at line 83 of file Stream.h.
Referenced by TestAuthConfig::create(), debugArg(), Enabled(), ResetSections(), Debug::Context::rewind(), TestProgram::run(), and TestAuthUserRequest::scheme().
◆ log_syslog
|
static |
Definition at line 85 of file Stream.h.
Referenced by SettleSyslog(), and SyslogChannel::shouldWrite().
◆ override_X
|
static |
Definition at line 84 of file Stream.h.
Referenced by mainHandleCommandLineOption(), parseOptions(), and SettleStderr().
◆ rotateNumber
|
static |
Definition at line 82 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