Implements a thread-safe logging framework. More...
#include <LogStream.h>
Classes | |
struct | ThreadStreamInfo |
Public Member Functions | |
void | addOutputStream (LogOutputStream *new_stream) |
icl_core::logging::LogLevel | getLogLevel () const |
Get the log level of the current thread. | |
icl_core::logging::LogLevel | initialLogLevel () const |
Get the initial log level of this log stream. | |
bool | isActive () const |
Checks if the log stream is active. | |
LogStream (const icl_core::String &name, icl_core::logging::LogLevel initial_level=cDEFAULT_LOG_LEVEL) | |
icl_core::String | name () const |
Return the name of the log stream. | |
const char * | nameCStr () const |
void | printConfiguration () const |
Prints the list of connected log output streams. | |
void | removeOutputStream (LogOutputStream *stream) |
void | setActive (bool active=true) |
Activates or deactivates the log stream. | |
icl_core::logging::ThreadStream & | threadStream (icl_core::logging::LogLevel log_level) |
~LogStream () | |
Private Types | |
typedef std::list < ThreadStreamInfo > | ThreadStreamMap |
Private Member Functions | |
void | releaseThreadStream (icl_core::logging::ThreadStream *thread_stream) |
Private Attributes | |
bool | m_active |
icl_core::logging::LogLevel | m_initial_level |
Semaphore | m_mutex |
icl_core::String | m_name |
std::set< LogOutputStream * > | m_output_stream_list |
ThreadStreamMap | m_thread_stream_map |
Static Private Attributes | |
static ThreadId | m_empty_thread_id |
Friends | |
class | LoggingManager |
class | ThreadStream |
Implements a thread-safe logging framework.
Definition at line 54 of file LogStream.h.
typedef std::list<ThreadStreamInfo> icl_core::logging::LogStream::ThreadStreamMap [private] |
Definition at line 179 of file LogStream.h.
icl_core::logging::LogStream::LogStream | ( | const icl_core::String & | name, |
icl_core::logging::LogLevel | initial_level = cDEFAULT_LOG_LEVEL |
||
) |
Creates a new logstream which is not yet connected to any log output stream.
Definition at line 39 of file LogStream.cpp.
Definition at line 54 of file LogStream.cpp.
void icl_core::logging::LogStream::addOutputStream | ( | LogOutputStream * | new_stream | ) |
Adds a new log output stream to the log stream. All log messages are additionally written to this new log output stream.
Definition at line 72 of file LogStream.cpp.
Get the log level of the current thread.
Definition at line 66 of file LogStream.cpp.
icl_core::logging::LogLevel icl_core::logging::LogStream::initialLogLevel | ( | ) | const [inline] |
Get the initial log level of this log stream.
Definition at line 75 of file LogStream.h.
bool icl_core::logging::LogStream::isActive | ( | ) | const [inline] |
Checks if the log stream is active.
Definition at line 78 of file LogStream.h.
icl_core::String icl_core::logging::LogStream::name | ( | ) | const [inline] |
Return the name of the log stream.
Definition at line 68 of file LogStream.h.
const char* icl_core::logging::LogStream::nameCStr | ( | ) | const [inline] |
Definition at line 69 of file LogStream.h.
void icl_core::logging::LogStream::printConfiguration | ( | ) | const |
Prints the list of connected log output streams.
Definition at line 156 of file LogStream.cpp.
void icl_core::logging::LogStream::releaseThreadStream | ( | icl_core::logging::ThreadStream * | thread_stream | ) | [private] |
Definition at line 252 of file LogStream.cpp.
void icl_core::logging::LogStream::removeOutputStream | ( | LogOutputStream * | stream | ) |
Removes a log output stream from the log stream. Log messages are no longer written to this log output stream.
Definition at line 81 of file LogStream.cpp.
void icl_core::logging::LogStream::setActive | ( | bool | active = true | ) | [inline] |
Activates or deactivates the log stream.
Definition at line 72 of file LogStream.h.
icl_core::logging::ThreadStream & icl_core::logging::LogStream::threadStream | ( | icl_core::logging::LogLevel | log_level | ) |
Returns the underlying thread stream for the current thread.
This function should usually not be used directly. It is mainly intended to be used indirectly via the LOGGING_* log macros.
Definition at line 90 of file LogStream.cpp.
friend class LoggingManager [friend] |
Definition at line 56 of file LogStream.h.
friend class ThreadStream [friend] |
Definition at line 57 of file LogStream.h.
bool icl_core::logging::LogStream::m_active [private] |
Definition at line 183 of file LogStream.h.
ThreadId icl_core::logging::LogStream::m_empty_thread_id [static, private] |
Definition at line 189 of file LogStream.h.
Definition at line 163 of file LogStream.h.
Definition at line 187 of file LogStream.h.
Definition at line 182 of file LogStream.h.
std::set<LogOutputStream*> icl_core::logging::LogStream::m_output_stream_list [private] |
Definition at line 184 of file LogStream.h.
Definition at line 180 of file LogStream.h.