A class for handling multi-target log streams.
More...
#include <MultiStream.hpp>
|
void | flush_to_console (const std::string &message) const |
| Flush the accumulated message to the console on non-Windows platforms.
|
|
|
std::ostringstream | m_stream |
| Internal stream for accumulating log content.
|
|
bool | use_utf8 |
| Flag indicating whether UTF-8 encoding should be used.
|
|
A class for handling multi-target log streams.
MultiStream ensures consistent and platform-independent logging output:
- On Windows, UTF-8 strings are automatically converted to CP866 to support legacy console encoding.
- On Linux/macOS, UTF-8 strings are directly output to the console.
- Supports ANSI color codes for enhanced readability.
- Integrates with LogIt logging library for advanced log management (if enabled).
- Supports LogIt integration (if enabled) and platform-specific console handling.
Definition at line 26 of file MultiStream.hpp.
◆ MultiStream()
consolix::MultiStream::MultiStream |
( |
bool | use_utf8 = true | ) |
|
|
inline |
Default constructor for MultiStream without LogIt integration.
- Parameters
-
use_utf8 | Flag to indicate if UTF-8 encoding should be used. |
Definition at line 53 of file MultiStream.hpp.
◆ ~MultiStream()
consolix::MultiStream::~MultiStream |
( |
| ) |
|
|
inline |
Destructor to flush the accumulated log content.
Definition at line 58 of file MultiStream.hpp.
◆ flush_to_console()
void consolix::MultiStream::flush_to_console |
( |
const std::string & | message | ) |
const |
|
inlineprivate |
Flush the accumulated message to the console on non-Windows platforms.
- Parameters
-
message | The message to flush. |
Definition at line 113 of file MultiStream.hpp.
◆ operator<<() [1/2]
template<typename T>
MultiStream & consolix::MultiStream::operator<< |
( |
const T & | value | ) |
|
|
inline |
Overloaded operator<< for adding content to the stream.
- Template Parameters
-
T | The type of the content to log. |
- Parameters
-
- Returns
- Reference to the current MultiStream object.
Definition at line 86 of file MultiStream.hpp.
◆ operator<<() [2/2]
MultiStream & consolix::MultiStream::operator<< |
( |
std::ostream &(* | manip )(std::ostream &) | ) |
|
|
inline |
Overloaded operator<< for manipulators (e.g., std::endl).
- Parameters
-
manip | Manipulator function (e.g., std::endl). |
- Returns
- Reference to the current MultiStream object.
Definition at line 94 of file MultiStream.hpp.
◆ m_stream
std::ostringstream consolix::MultiStream::m_stream |
|
private |
Internal stream for accumulating log content.
Definition at line 100 of file MultiStream.hpp.
◆ use_utf8
bool consolix::MultiStream::use_utf8 |
|
private |
Flag indicating whether UTF-8 encoding should be used.
Definition at line 108 of file MultiStream.hpp.
The documentation for this class was generated from the following file: