Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes
coil::log_stream< _CharT, _Traits > Class Template Reference

log_stream template class More...

#include <Logger.h>

Inheritance diagram for coil::log_stream< _CharT, _Traits >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef _CharT char_type
typedef coil::Guard< MutexGuard
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_typelevel (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_streamoperator= (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

Detailed Description

template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
class coil::log_stream< _CharT, _Traits >

log_stream template class

Definition at line 540 of file coil/common/Logger.h.


Member Typedef Documentation

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
typedef _CharT coil::log_stream< _CharT, _Traits >::char_type

Definition at line 545 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
typedef coil::Guard<Mutex> coil::log_stream< _CharT, _Traits >::Guard

Definition at line 550 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
typedef coil::Mutex coil::log_stream< _CharT, _Traits >::Mutex

Definition at line 549 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
typedef _Traits coil::log_stream< _CharT, _Traits >::traits_type

Definition at line 546 of file coil/common/Logger.h.


Constructor & Destructor Documentation

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
coil::log_stream< _CharT, _Traits >::log_stream ( streambuf_type sb,
int  levelmin,
int  levelmax,
int  level 
) [inline]

Constructor.

Constructor

Parameters:
streambufbasic_streambuf type object
levelminminimum value for log level
levelmaxmaximum value for log level
leveldefault log level

Definition at line 577 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
coil::log_stream< _CharT, _Traits >::~log_stream ( ) [inline, protected]

Destructor.

Destructor

Definition at line 828 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
coil::log_stream< _CharT, _Traits >::log_stream ( ) [protected]

Default constructor.

Default constructor

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
coil::log_stream< _CharT, _Traits >::log_stream ( const log_stream< _CharT, _Traits > &  x) [protected]

Copy Constructor.

Copy Constructor

Parameters:
xlog_stream object

Member Function Documentation

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
void coil::log_stream< _CharT, _Traits >::disableLock ( ) [inline]

Disable the lock mode.

Definition at line 696 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
void coil::log_stream< _CharT, _Traits >::enableLock ( ) [inline]

Enable the lock mode.

Definition at line 676 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
int coil::log_stream< _CharT, _Traits >::getLevel ( ) const [inline]

Get the log level.

Get the log level.

Returns:
Log level

Definition at line 656 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.

Parameters:
levelLog level
Returns:
true: Valid, false: Invalid

Definition at line 769 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.

Parameters:
levelThe specified log level
Returns:
Target log stream

Definition at line 732 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
log_stream& coil::log_stream< _CharT, _Traits >::operator= ( const log_stream< _CharT, _Traits > &  x) [protected]

Assignment operator.

Copy a log_stream object.

Parameters:
xlog_stream object.
Returns:
Assignment result.
template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
bool coil::log_stream< _CharT, _Traits >::setLevel ( int  level) [inline]

Set the log level.

Set the log level.

Parameters:
levelLog level

Definition at line 627 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
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.


Member Data Documentation

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
std::ofstream coil::log_stream< _CharT, _Traits >::m_dummy [private]

Dummy log.

Definition at line 904 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
bool coil::log_stream< _CharT, _Traits >::m_lockEnable = true [static]

Lock enable mode.

Definition at line 914 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
int coil::log_stream< _CharT, _Traits >::m_logLevel [private]

Definition at line 895 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
int coil::log_stream< _CharT, _Traits >::m_maxLevel [private]

Definition at line 894 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
int coil::log_stream< _CharT, _Traits >::m_minLevel [private]

Definition at line 894 of file coil/common/Logger.h.

template<typename _CharT , typename _Traits = std::char_traits<_CharT>>
coil::Mutex coil::log_stream< _CharT, _Traits >::m_mutex [static]

Mutual exclusion object.

Definition at line 923 of file coil/common/Logger.h.


The documentation for this class was generated from the following file:


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sat Jun 8 2019 18:49:10