Sends logging messages to the stream. More...
#include <cadex/Utilities/LoggerStreamHandler.hxx>
Public Types | |
typedef std::ostream | StreamType |
Defines a stream type. | |
Public Member Functions | |
LoggerStreamHandler (StreamType &theStream) | |
Constructor. | |
bool | IsEOLAppended () const |
Returns true if the end-of-line symbol is to be added after each message. | |
void | SetIsEOLAppended (bool theValue) |
bool | IsImmediateFlushEnabled () const |
Returns true if each message must be flushed into the stream. | |
void | SetIsImmediateFlushEnabled (bool theValue) |
void | Append (const UTF16String &theMessage) override |
Outputs a message into the stream. | |
![]() | |
virtual | ~LoggerHandler () |
Destructor. | |
internal::LoggerHandlerImpl * | Impl () const |
Reserved for internal use. | |
template<typename T > | |
T * | Impl () const |
Reserved for internal use. | |
Additional Inherited Members | |
![]() | |
LoggerHandler (std::unique_ptr< internal::LoggerHandlerImpl > &&theImpl) | |
Constructor. | |
Sends logging messages to the stream.
The stream must be opened before using the handler and must remain opened and valid throughout its life span. Internally the handler stores a reference to the stream and thus destroying the stream earlier will likely lead to a crash.
The stream handler can be used with standard streams as follows:
The stream handler provides two boolean flags: IsEOLAppended() - 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. IsImmediateFlushEnabled() - if true then each message will be flushed into the stream during processing in Append(). By default, true.
typedef std::ostream cadex::Utilities::LoggerStreamHandler::StreamType |
Defines a stream type.
Uses UTF-8 encoding when writing.
|
overridevirtual |
Outputs a message into the stream.
Implements cadex::Utilities::LoggerHandler.