log_stream template class More...
#include <Logger.h>
Public Types | |
typedef _CharT | char_type |
typedef coil::Guard< Mutex > | Guard |
typedef coil::Mutex | Mutex |
typedef std::basic_ostream < char_type, traits_type > | ostream_type |
typedef std::basic_streambuf < char_type, traits_type > | streambuf_type |
typedef _Traits | traits_type |
Public Member Functions | |
void | disableLock () |
void | enableLock () |
int | getLevel () const |
Get the log level. | |
virtual void | header (int level) |
Message header appender function. | |
bool | isValid (int level) const |
Log level effective check. | |
ostream_type & | level (int level) |
Acquire log stream. | |
void | lock () |
Acquire log lock Acquire log lock when the lock mode is set. | |
log_stream (streambuf_type *sb, int levelmin, int levelmax, int level) | |
Constructor. | |
bool | setLevel (int level) |
Set the log level. | |
void | unlock () |
Release the log lock Release the log lock when the lock mode is set. | |
Static Public Attributes | |
static bool | m_lockEnable = true |
Lock enable mode. | |
static Mutex | m_mutex |
Mutual exclusion object. | |
Protected Member Functions | |
log_stream () | |
Default constructor. | |
log_stream (const log_stream &x) | |
Copy Constructor. | |
log_stream & | operator= (const log_stream &x) |
Assignment operator. | |
~log_stream () | |
Destructor. | |
Private Attributes | |
std::ofstream | m_dummy |
Dummy log. | |
int | m_logLevel |
int | m_maxLevel |
int | m_minLevel |
log_stream template class
Definition at line 540 of file coil/common/Logger.h.
typedef _CharT coil::log_stream< _CharT, _Traits >::char_type |
Definition at line 545 of file coil/common/Logger.h.
typedef coil::Guard<Mutex> coil::log_stream< _CharT, _Traits >::Guard |
Definition at line 550 of file coil/common/Logger.h.
typedef coil::Mutex coil::log_stream< _CharT, _Traits >::Mutex |
Definition at line 549 of file coil/common/Logger.h.
typedef std::basic_ostream<char_type, traits_type> coil::log_stream< _CharT, _Traits >::ostream_type |
Definition at line 547 of file coil/common/Logger.h.
typedef std::basic_streambuf<char_type, traits_type> coil::log_stream< _CharT, _Traits >::streambuf_type |
Definition at line 548 of file coil/common/Logger.h.
typedef _Traits coil::log_stream< _CharT, _Traits >::traits_type |
Definition at line 546 of file coil/common/Logger.h.
coil::log_stream< _CharT, _Traits >::log_stream | ( | streambuf_type * | sb, |
int | levelmin, | ||
int | levelmax, | ||
int | level | ||
) | [inline] |
Constructor.
Constructor
streambuf | basic_streambuf type object |
levelmin | minimum value for log level |
levelmax | maximum value for log level |
level | default log level |
Definition at line 577 of file coil/common/Logger.h.
coil::log_stream< _CharT, _Traits >::~log_stream | ( | ) | [inline, protected] |
coil::log_stream< _CharT, _Traits >::log_stream | ( | ) | [protected] |
Default constructor.
Default constructor
coil::log_stream< _CharT, _Traits >::log_stream | ( | const log_stream< _CharT, _Traits > & | x | ) | [protected] |
void coil::log_stream< _CharT, _Traits >::disableLock | ( | ) | [inline] |
Disable the lock mode.
Definition at line 696 of file coil/common/Logger.h.
void coil::log_stream< _CharT, _Traits >::enableLock | ( | ) | [inline] |
Enable the lock mode.
Definition at line 676 of file coil/common/Logger.h.
int coil::log_stream< _CharT, _Traits >::getLevel | ( | ) | const [inline] |
Get the log level.
Get the log level.
Definition at line 656 of file coil/common/Logger.h.
virtual void coil::log_stream< _CharT, _Traits >::header | ( | int | level | ) | [inline, virtual] |
Message header appender function.
Subclasses of this class should override this operation, and this function should be defined to append some header to the log messages.
Reimplemented in RTC::Logger, Logger::LogOut, and Tests::LoggerMock.
Definition at line 603 of file coil/common/Logger.h.
bool coil::log_stream< _CharT, _Traits >::isValid | ( | int | level | ) | const [inline] |
Log level effective check.
Check it whether an appointed log level is an effective range and return effective or invalidity.
level | Log level |
Definition at line 769 of file coil/common/Logger.h.
ostream_type& coil::log_stream< _CharT, _Traits >::level | ( | int | level | ) | [inline] |
Acquire log stream.
Investigate the specified log level and get its log stream. If the specified log level is under the set log level, this class will be returned. If the specified log level exceeds the set log level, a dummy log class will be returned.
level | The specified log level |
Definition at line 732 of file coil/common/Logger.h.
void coil::log_stream< _CharT, _Traits >::lock | ( | ) | [inline] |
Acquire log lock Acquire log lock when the lock mode is set.
Definition at line 787 of file coil/common/Logger.h.
log_stream& coil::log_stream< _CharT, _Traits >::operator= | ( | const log_stream< _CharT, _Traits > & | x | ) | [protected] |
Assignment operator.
Copy a log_stream object.
x | log_stream object. |
bool coil::log_stream< _CharT, _Traits >::setLevel | ( | int | level | ) | [inline] |
Set the log level.
Set the log level.
level | Log level |
Definition at line 627 of file coil/common/Logger.h.
void coil::log_stream< _CharT, _Traits >::unlock | ( | ) | [inline] |
Release the log lock Release the log lock when the lock mode is set.
Definition at line 805 of file coil/common/Logger.h.
std::ofstream coil::log_stream< _CharT, _Traits >::m_dummy [private] |
Dummy log.
Definition at line 904 of file coil/common/Logger.h.
bool coil::log_stream< _CharT, _Traits >::m_lockEnable = true [static] |
Lock enable mode.
Definition at line 914 of file coil/common/Logger.h.
int coil::log_stream< _CharT, _Traits >::m_logLevel [private] |
Definition at line 895 of file coil/common/Logger.h.
int coil::log_stream< _CharT, _Traits >::m_maxLevel [private] |
Definition at line 894 of file coil/common/Logger.h.
int coil::log_stream< _CharT, _Traits >::m_minLevel [private] |
Definition at line 894 of file coil/common/Logger.h.
coil::Mutex coil::log_stream< _CharT, _Traits >::m_mutex [static] |
Mutual exclusion object.
Definition at line 923 of file coil/common/Logger.h.