Implements the actual logging for an individual thread. More...
#include <ThreadStream.h>
Public Types | |
typedef ThreadStream &(* | ThreadStreamFunc) (ThreadStream &) |
Public Member Functions | |
void | changeLevel (icl_core::logging::LogLevel level) |
void | flush () |
icl_core::logging::LogLevel | getLogLevel () const |
ThreadStream & | operator<< (ThreadStreamFunc func) |
void | printf (const char *fmt,...) |
void | setClassname (const char *classname) |
void | setFilename (const char *filename) |
void | setFunction (const char *function) |
void | setLine (size_t line) |
void | setLineLogLevel (icl_core::logging::LogLevel line_log_level) |
void | setObjectname (const char *objectname) |
void | write (const char *buffer, size_t number_of_bytes, size_t protected_buffer_size=1) |
Private Member Functions | |
ThreadStream (LogStream *parent) | |
~ThreadStream () | |
Private Attributes | |
char | m_classname [cDEFAULT_LOG_SIZE+1] |
char | m_data [cDEFAULT_LOG_SIZE+1] |
char | m_filename [cDEFAULT_LOG_SIZE+1] |
char | m_function [cDEFAULT_LOG_SIZE+1] |
icl_core::logging::LogLevel | m_level |
size_t | m_line |
icl_core::logging::LogLevel | m_line_log_level |
char | m_objectname [cDEFAULT_LOG_SIZE+1] |
LogStream * | m_parent |
size_t | m_write_index |
Friends | |
class | LogStream |
Implements the actual logging for an individual thread.
Definition at line 58 of file ThreadStream.h.
typedef ThreadStream&(* icl_core::logging::ThreadStream::ThreadStreamFunc) (ThreadStream &) |
Type definition for flush() and endl() functions.
Definition at line 129 of file ThreadStream.h.
|
private |
Thread stream objects are always created by LogStream so the constructor is private.
Definition at line 149 of file ThreadStream.cpp.
|
inlineprivate |
Definition at line 220 of file ThreadStream.h.
|
inline |
Change the thread stream's log level to level.
Definition at line 64 of file ThreadStream.h.
void icl_core::logging::ThreadStream::flush | ( | ) |
Flushes the internal buffer of the thread stream to the parent's registered log output streams.
Definition at line 125 of file ThreadStream.cpp.
|
inline |
Return the current log level of this thread stream.
Definition at line 68 of file ThreadStream.h.
|
inline |
This operator allows us to stream the flush() and endl() functions into a ThreadStream just like any other datatype.
Definition at line 134 of file ThreadStream.h.
void icl_core::logging::ThreadStream::printf | ( | const char * | fmt, |
... | |||
) |
Writes text to the thread stream. Uses a printf-style format string and variable number of additional arguments.
Implicitly flushes the thread stream.
Definition at line 100 of file ThreadStream.cpp.
void icl_core::logging::ThreadStream::setClassname | ( | const char * | classname | ) |
Set the classname of the current log entry.
This value is automatically reset after a flush().
Definition at line 50 of file ThreadStream.cpp.
void icl_core::logging::ThreadStream::setFilename | ( | const char * | filename | ) |
Set the filename of the current log entry.
This value is automatically reset after a flush().
Definition at line 55 of file ThreadStream.cpp.
void icl_core::logging::ThreadStream::setFunction | ( | const char * | function | ) |
Set the function of the current log entry.
This value is automatically reset after a flush().
Definition at line 65 of file ThreadStream.cpp.
void icl_core::logging::ThreadStream::setLine | ( | size_t | line | ) |
Set the line of the current log entry.
This value is automatically reset after a flush().
Definition at line 70 of file ThreadStream.cpp.
void icl_core::logging::ThreadStream::setLineLogLevel | ( | icl_core::logging::LogLevel | line_log_level | ) |
Set the log level of the current log line.
Definition at line 75 of file ThreadStream.cpp.
void icl_core::logging::ThreadStream::setObjectname | ( | const char * | objectname | ) |
Set the objectname of the current log entry.
This value is automatically reset after a flush().
Definition at line 60 of file ThreadStream.cpp.
void icl_core::logging::ThreadStream::write | ( | const char * | buffer, |
size_t | number_of_bytes, | ||
size_t | protected_buffer_size = 1 |
||
) |
Writes number_of_bytes characters from buffer to the thread stream. protected_buffer_size is the number of bytes to keep free at the end of the buffer. Normal Write operations should leave this at 1 so that there is always room for a Newline character. Only the endl() function sets this to 0 to be able to add the Newline character and thus make sure that even when the buffer is filled completely, a line break is still inserted correctly.
Definition at line 80 of file ThreadStream.cpp.
|
friend |
Definition at line 60 of file ThreadStream.h.
|
private |
Definition at line 229 of file ThreadStream.h.
|
private |
Definition at line 232 of file ThreadStream.h.
|
private |
Definition at line 227 of file ThreadStream.h.
|
private |
Definition at line 231 of file ThreadStream.h.
|
private |
Definition at line 224 of file ThreadStream.h.
|
private |
Definition at line 228 of file ThreadStream.h.
|
private |
Definition at line 226 of file ThreadStream.h.
|
private |
Definition at line 230 of file ThreadStream.h.
|
private |
Definition at line 223 of file ThreadStream.h.
|
private |
Definition at line 233 of file ThreadStream.h.