LogIt++
|
A stream-based logger that collects log messages using the <<
operator.
More...
#include <LogStream.hpp>
Public Member Functions | |
LogStream (const LogLevel &level, const std::string &file, const int &line, const std::string &function, const int &logger_index) | |
Constructor. | |
~LogStream () | |
Destructor that logs the collected message when the object goes out of scope. | |
template<typename T > | |
LogStream & | operator<< (const T &value) |
Overloaded << operator to accumulate log content. | |
Private Attributes | |
LogLevel | m_level |
Log level. | |
std::ostringstream | m_stream |
Stream for accumulating log content. | |
std::string | m_file |
Source file name. | |
int | m_line |
Line number. | |
std::string | m_function |
Function name. | |
int | m_logger_index |
Logger index. | |
A stream-based logger that collects log messages using the <<
operator.
The LogStream
class allows for logging messages in a stream-like manner. It collects log data through the <<
operator and automatically sends the log message when the object is destroyed.
Definition at line 18 of file LogStream.hpp.
|
inline |
Constructor.
level | The log level. |
file | Source file name. |
line | Line number in the source file. |
function | Function name. |
logger_index | Logger index to use. |
Definition at line 27 of file LogStream.hpp.
|
inline |
Destructor that logs the collected message when the object goes out of scope.
When the LogStream
object is destroyed, the log message is automatically sent using the Logger
instance. The message is collected through the <<
operator and stored in an internal string stream until the object is destructed.
Definition at line 42 of file LogStream.hpp.
|
inline |
Overloaded <<
operator to accumulate log content.
T | The type of value to log. |
value | The value to add to the log message. |
LogStream
for chaining. Definition at line 58 of file LogStream.hpp.
|
private |
Source file name.
Definition at line 66 of file LogStream.hpp.
|
private |
Function name.
Definition at line 68 of file LogStream.hpp.
|
private |
Log level.
Definition at line 64 of file LogStream.hpp.
|
private |
Line number.
Definition at line 67 of file LogStream.hpp.
|
private |
Logger index.
Definition at line 69 of file LogStream.hpp.
|
private |
Stream for accumulating log content.
Definition at line 65 of file LogStream.hpp.