debug.cc
Go to the documentation of this file.
594 DebugChannel::saveMessage(const DebugMessageHeader &header, const CompiledDebugMessageBody &body)
613 DebugChannel::writeToStream(FILE &destination, const DebugMessageHeader &header, const CompiledDebugMessageBody &body)
734 DebugMessageHeader::DebugMessageHeader(const DebugRecordCount aRecordNumber, const Debug::Context &context):
1209 debugs(0, DBG_IMPORTANT, "ERROR: removal of log file " << to << " failed: " << xstrerr(saved_errno));
1240 const auto sz = snprintf(buf, sizeof(buf), "%s.%03d", buf2, static_cast<int>(t.tv_usec / 1000));
1269 debugs(0, DBG_CRITICAL, "FATAL: assertion failed: " << file << ":" << line << ": \"" << msg << "\"");
virtual ~DebugChannel()=default
std::deque< CompiledDebugMessage > CompiledDebugMessages
debugs() messages captured in LogMessage() call order
Definition: debug.cc:145
void takeOver(CacheLogChannel &)
start to take care of past/saved and future cacheLovirtual gChannel messages
Definition: debug.cc:673
output iterator for writing CompiledDebugMessages to a given channel
Definition: debug.cc:175
static void FormatStream(std::ostream &)
configures default formatting for the debugging stream
Definition: debug.cc:1305
static void LogWaitingForIdle()
Logs messages of Finish()ed debugs() calls that were queued earlier.
Definition: debug.cc:1327
DebugChannel managing messages destined for the configured cache_log file.
Definition: debug.cc:239
void log(char *format,...)
void noteWritten(const DebugMessageHeader &)
reacts to a written a debugs() message
Definition: debug.cc:623
DebugMessageHeader(const DebugRecordCount aRecordNumber, const Debug::Context &)
Definition: debug.cc:734
static size_t LoggingConcurrencyLevel
the current number of protected callers
Definition: debug.cc:340
static void StopSavingAndLog(DebugChannel &, DebugChannel *=nullptr)
stop saving and log() any "early" messages, in recordNumber order
Definition: debug.cc:569
std::unique_ptr< CompiledDebugMessages > EarlyMessages
Definition: debug.cc:151
std::string CompiledDebugMessageBody
The processed "content" (i.e. the last parameter) part of a debugs() call.
Definition: debug.cc:126
~DebugModule()=delete
static void ConfigureSyslog(const char *facility)
enables logging to syslog (using the specified facility, when not nil)
Definition: debug.cc:1083
static std::ostringstream & Start(const int section, const int level)
opens debugging context and returns output buffer
Definition: debug.cc:1342
Logger & operator=(const CompiledDebugMessage &message)
Definition: debug.cc:186
DebugRecordCount written
the number of messages sent to the underlying channel so far
Definition: debug.cc:227
virtual void write(const DebugMessageHeader &, const CompiledDebugMessageBody &)=0
write the corresponding debugs() message into the channel
static bool Enabled(const int section, const int level)
whether debugging the given section and the given level produces output
Definition: Stream.h:75
virtual bool shouldWrite(const DebugMessageHeader &) const =0
static constexpr int EarlyMessagesLevel
early debugs() with higher level are not buffered and, hence, may be lost
Definition: debug.cc:56
bool collectingEarlyMessages() const
whether we are still expecting (and buffering) early messages
Definition: debug.cc:160
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:18
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
CompiledDebugMessage(const Header &, const Body &)
Definition: debug.cc:746
static void ForgetSaved()
silently erases saved early debugs() messages (if any)
Definition: debug.cc:554
static void Finish()
logs output buffer created in Start() and closes debugging context
Definition: debug.cc:1366
void write(const DebugMessageHeader &, const CompiledDebugMessageBody &) final
write the corresponding debugs() message into the channel
Definition: debug.cc:1065
DebugRecordCount lastWrittenRecordNumber
DebugMessageHeader::recordNumber of the last message we wrote.
Definition: debug.cc:230
Definition: debug.cc:329
static void EnsureDefaultStderrLevel(int maxDefault)
Definition: debug.cc:693
void write(const DebugMessageHeader &, const CompiledDebugMessageBody &) final
write the corresponding debugs() message into the channel
Definition: debug.cc:638
void stopCoveringForCacheLog()
stop providing a cache_log replacement (if we were providing it)
Definition: debug.cc:683
void stopEarlyMessageCollection()
end early message buffering, logging any saved messages
Definition: debug.cc:529
void log(const DebugMessageHeader &, const CompiledDebugMessageBody &)
Definition: debug.cc:537
bool coveringForCacheLog
whether we are the last resort for logging debugs() messages
Definition: debug.cc:272
std::ostream & CurrentCodeContextDetail(std::ostream &os)
Definition: CodeContext.cc:96
void reset(FILE *newFile, const char *newName)
switches to the new pair, absorbing FILE and duping the name
Definition: debug.cc:755
bool shouldWrite(const DebugMessageHeader &) const final
Definition: debug.cc:661
static void ResetSections(const int level=DBG_IMPORTANT)
used for the side effect: fills Debug::Levels with the given level
Definition: debug.cc:361
void rewind(const int aSection, const int aLevel)
Optimization: avoids new Context creation for every debugs().
Definition: debug.cc:1290
DebugChannel managing messages destined for "standard error stream" (stderr)
Definition: debug.cc:251
bool shouldWrite(const DebugMessageHeader &) const final
Definition: debug.cc:632
friend void ResyncDebugLog(FILE *newFile)
a hack for low-level file descriptor manipulations in ipcCreate()
Definition: debug.cc:515
void log(const DebugMessageHeader &, const CompiledDebugMessageBody &)
Definition: debug.cc:447
static void LogMessage(const Context &)
broadcasts debugs() message to the logging channels
Definition: debug.cc:781
static void ForceAlert()
configures the active debugging context to write syslog ALERT
Definition: debug.cc:1403
static std::string ProcessLabel
pre-formatted name of the current process for debugs() messages (or empty)
Definition: debug.cc:59
void ResyncDebugLog(FILE *newFile)
a hack for low-level file descriptor manipulations in ipcCreate()
Definition: debug.cc:515
Definition: debug.cc:296
bool shouldWrite(const DebugMessageHeader &) const final
Definition: debug.cc:1073
static void LabelThisProcess(const char *const name, const std::optional< int > id=std::optional< int >())
optimization: formats ProcessLabel once for frequent debugs() reuse
Definition: debug.cc:370
void writeToStream(FILE &, const DebugMessageHeader &, const CompiledDebugMessageBody &)
Formats a validated debugs() record and writes it to the given FILE.
Definition: debug.cc:613
void saveMessage(const DebugMessageHeader &, const CompiledDebugMessageBody &)
stores the given early message (if possible) or forgets it (otherwise)
Definition: debug.cc:594
void write(const DebugMessageHeader &, const CompiledDebugMessageBody &) final
write the corresponding debugs() message into the channel
Definition: debug.cc:667
std::output_iterator_tag iterator_category
Definition: debug.cc:182
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