Hide menu
Loading...
Searching...
No Matches
cadex::Base_LoggerStreamAppender Class Reference

Provides logging messages in the stream. More...

#include <cadex/Base_LoggerStreamAppender.hxx>

Inheritance diagram for cadex::Base_LoggerStreamAppender:
cadex::Base_LoggerAppender

Public Types

typedef std::ostream StreamType
 Defines a stream type.
 
- Public Types inherited from cadex::Base_LoggerAppender
typedef UTF16 CharType
 Defines a character type of user-visible strings.
 
typedef const UTF16CharPointerType
 Defines a type of the pointer to the character type.
 

Public Member Functions

 Base_LoggerStreamAppender (StreamType &theStream)
 Constructor.
 
bool AppendEOL () const
 Returns true if the end-of-line symbol is to be added after each message.
 
bool & AppendEOL ()
 Returns true if the end-of-line symbol is to be added after each message.
 
bool ImmediateFlush () const
 Returns true if each message must be flushed into the stream.
 
bool & ImmediateFlush ()
 Returns true if each message must be flushed into the stream.
 
virtual void Append (CharPointerType theMessage)
 Outputs a message into the stream.
 
- Public Member Functions inherited from cadex::Base_LoggerAppender
virtual ~Base_LoggerAppender ()
 Destructor.
 
Base_LoggerAppenderoperator= (const Base_LoggerAppender &theAppender)
 Assignment operator.
 
virtual void Append (CharPointerType theMessage)=0
 Appends a message.
 
const std::shared_ptr< internal::Base_LoggerAppenderImpl > & Impl () const
 Returns internal implementation object.
 

Additional Inherited Members

- Protected Member Functions inherited from cadex::Base_LoggerAppender
 Base_LoggerAppender ()
 Constructor.
 
 Base_LoggerAppender (const std::shared_ptr< internal::Base_LoggerAppenderImpl > &theImpl)
 Constructor.
 
 Base_LoggerAppender (const Base_LoggerAppender &theAppender)
 Constructor.
 
void Construct (const std::shared_ptr< internal::Base_LoggerAppenderImpl > &theImpl)
 Delayed constructor.
 
Base_LoggerAppenderThis ()
 Returns a pointer to this object.
 

Detailed Description

Provides logging messages in the stream.

The stream must be opened before using the appender and must remain opened and valid throughout its life span. Internally the appender stores a reference to the stream and thus destroying the stream earlier will likely lead to a crash.

The stream appender can be used with standard streams as follows:

Base_LoggerStreamAppender aCOutAppender (std::wcout);
Base_LoggerStreamAppender aCErrAppender (std::wcerr);
Provides logging messages in the stream.
Definition: Base_LoggerStreamAppender.hxx:30

The stream appender provides two boolean flags: AppendEOL() - if true then each message will be appended with end-of-line symbol (which is OS-specific, e.g. 0x0A on Linux and 0x0D 0x0A on Windows). By default, true. ImmediateFlush() - if true then each message will be flushed into the stream during processing in Append(). By default, true.

See also
Base_LoggerFileAppender.
Examples
misc/logging/main.cxx.

Member Typedef Documentation

◆ StreamType

Defines a stream type.

Uses UTF-8 encoding when writing.

Member Function Documentation

◆ Append()

void cadex::Base_LoggerStreamAppender::Append ( CharPointerType  theMessage)
virtual

Outputs a message into the stream.

Implements cadex::Base_LoggerAppender.