A class for handling multi-target log streams.
More...
#include <MultiStream.hpp>
|
| MultiStream ()=default |
| Default constructor for MultiStream without LogIt integration.
|
|
| ~MultiStream () |
| Destructor to flush the accumulated log content.
|
|
template<typename T> |
MultiStream & | operator<< (const T &value) |
| Overloaded operator<< for adding content to the stream.
|
|
MultiStream & | operator<< (std::ostream &(*manip)(std::ostream &)) |
| Overloaded operator<< for manipulators (e.g., std::endl).
|
|
|
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.
|
|
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 |
( |
| ) |
|
|
default |
Default constructor for MultiStream without LogIt integration.
◆ ~MultiStream()
consolix::MultiStream::~MultiStream |
( |
| ) |
|
|
inline |
Destructor to flush the accumulated log content.
Definition at line 57 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 110 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 85 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 93 of file MultiStream.hpp.
◆ m_stream
std::ostringstream consolix::MultiStream::m_stream |
|
private |
Internal stream for accumulating log content.
Definition at line 99 of file MultiStream.hpp.
The documentation for this class was generated from the following file: