DebugChannel managing messages destined for "standard error stream" (stderr) More...

Inheritance diagram for StderrChannel:
Collaboration diagram for StderrChannel:

Public Types

using EarlyMessages = std::unique_ptr< CompiledDebugMessages >

Public Member Functions

 StderrChannel ()
void takeOver (CacheLogChannel &)
 start to take care of past/saved and future cacheLovirtual gChannel messages More...
void stopCoveringForCacheLog ()
 stop providing a cache_log replacement (if we were providing it) More...
bool enabled (const int messageDebugLevel) const
bool collectingEarlyMessages () const
 whether we are still expecting (and buffering) early messages More...
void stopEarlyMessageCollection ()
 end early message buffering, logging any saved messages More...
EarlyMessages releaseEarlyMessages ()
void log (const DebugMessageHeader &, const CompiledDebugMessageBody &)

Protected Member Functions

bool shouldWrite (const DebugMessageHeader &) const final
void write (const DebugMessageHeader &, const CompiledDebugMessageBody &) final
 write the corresponding debugs() message into the channel More...
void saveMessage (const DebugMessageHeader &, const CompiledDebugMessageBody &)
 stores the given early message (if possible) or forgets it (otherwise) More...
void writeToStream (FILE &, const DebugMessageHeader &, const CompiledDebugMessageBody &)
 Formats a validated debugs() record and writes it to the given FILE. More...
void noteWritten (const DebugMessageHeader &)
 reacts to a written a debugs() message More...

Static Protected Member Functions

static void StopSavingAndLog (DebugChannel &, DebugChannel *=nullptr)
 stop saving and log() any "early" messages, in recordNumber order More...

Protected Attributes

const char *const name = nullptr
 unique channel label for debugging More...
DebugRecordCount written = 0
 the number of messages sent to the underlying channel so far More...
DebugRecordCount lastWrittenRecordNumber = 0
 DebugMessageHeader::recordNumber of the last message we wrote. More...
EarlyMessages earlyMessages

Private Attributes

bool coveringForCacheLog = false
 whether we are the last resort for logging debugs() messages More...

Detailed Description

Definition at line 250 of file

Member Typedef Documentation

◆ EarlyMessages

using DebugChannel::EarlyMessages = std::unique_ptr<CompiledDebugMessages>

Definition at line 150 of file

Constructor & Destructor Documentation

◆ StderrChannel()

StderrChannel::StderrChannel ( )

Definition at line 253 of file

Member Function Documentation

◆ collectingEarlyMessages()

bool DebugChannel::collectingEarlyMessages ( ) const

Definition at line 159 of file

References DebugChannel::earlyMessages.

Referenced by DebugModule::prepareToDie().

◆ enabled()

bool StderrChannel::enabled ( const int  messageDebugLevel) const

whether we should write() the corresponding debugs() message now (assumes some higher-level code applied cache.log section/level filter)

Definition at line 646 of file

References coveringForCacheLog, DefaultStderrLevel, and ExplicitStderrLevel.

Referenced by shouldWrite(), and Debug::StderrEnabled().

◆ log()

void DebugChannel::log ( const DebugMessageHeader header,
const CompiledDebugMessageBody body 

Write the message to the channel if the channel accepts (such) messages. This writing may be delayed until the channel configuration is settled.

Definition at line 536 of file

References DebugChannel::lastWrittenRecordNumber, DebugMessageHeader::recordNumber, DebugChannel::saveMessage(), DebugChannel::shouldWrite(), DebugChannel::stopEarlyMessageCollection(), and DebugChannel::write().

Referenced by DebugModule::log().

◆ noteWritten()

void DebugChannel::noteWritten ( const DebugMessageHeader header)

◆ releaseEarlyMessages()

EarlyMessages DebugChannel::releaseEarlyMessages ( )

end early message buffering, without logging any saved messages

(a possibly empty container with) saved messages or nil

Definition at line 166 of file

References DebugChannel::earlyMessages.

Referenced by DebugChannel::StopSavingAndLog().

◆ saveMessage()

void DebugChannel::saveMessage ( const DebugMessageHeader header,
const CompiledDebugMessageBody body 

◆ shouldWrite()

bool StderrChannel::shouldWrite ( const DebugMessageHeader ) const

whether we should write() the corresponding debugs() message now (assumes some higher-level code applied cache.log section/level filter)

Implements DebugChannel.

Definition at line 660 of file

References enabled(), and DebugMessageHeader::level.

◆ stopCoveringForCacheLog()

void StderrChannel::stopCoveringForCacheLog ( )

Definition at line 682 of file

References coveringForCacheLog, DBG_IMPORTANT, and debugs.

Referenced by DebugModule::useCacheLog().

◆ stopEarlyMessageCollection()

void DebugChannel::stopEarlyMessageCollection ( )

◆ StopSavingAndLog()

void DebugChannel::StopSavingAndLog ( DebugChannel channelA,
DebugChannel channelBOrNil = nullptr 

◆ takeOver()

void StderrChannel::takeOver ( CacheLogChannel cacheLogChannel)

Definition at line 672 of file

References coveringForCacheLog, and DebugChannel::StopSavingAndLog().

Referenced by DebugModule::banCacheLogUse().

◆ write()

void StderrChannel::write ( const DebugMessageHeader ,
const CompiledDebugMessageBody  

Implements DebugChannel.

Definition at line 666 of file

References DebugChannel::writeToStream().

◆ writeToStream()

void DebugChannel::writeToStream ( FILE &  destination,
const DebugMessageHeader header,
const CompiledDebugMessageBody body 

Member Data Documentation

◆ coveringForCacheLog

bool StderrChannel::coveringForCacheLog = false

Definition at line 271 of file

Referenced by enabled(), stopCoveringForCacheLog(), and takeOver().

◆ earlyMessages

EarlyMessages DebugChannel::earlyMessages

debugs() messages waiting for the channel configuration to settle (and the channel to open) so that their eligibility for logging can be determined (and the messages can be actually written somewhere)

Definition at line 234 of file

Referenced by DebugChannel::collectingEarlyMessages(), DebugChannel::releaseEarlyMessages(), DebugChannel::saveMessage(), and DebugChannel::stopEarlyMessageCollection().

◆ lastWrittenRecordNumber

DebugRecordCount DebugChannel::lastWrittenRecordNumber = 0

Definition at line 229 of file

Referenced by DebugChannel::log(), and DebugChannel::noteWritten().

◆ name

const char* const DebugChannel::name = nullptr

Definition at line 223 of file

Referenced by DebugChannel::StopSavingAndLog().

◆ written

DebugRecordCount DebugChannel::written = 0

Definition at line 226 of file

Referenced by DebugChannel::noteWritten(), and DebugChannel::StopSavingAndLog().

The documentation for this class was generated from the following file:






Web Site Translations