Public Types | Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
RTC::Logger Class Reference

Logger class. More...

#include <SystemLogger.h>

Inheritance diagram for RTC::Logger:
Inheritance graph
[legend]

Public Types

enum  {
  RTL_SILENT, RTL_FATAL, RTL_ERROR, RTL_WARN,
  RTL_INFO, RTL_DEBUG, RTL_TRACE, RTL_VERBOSE,
  RTL_PARANOID
}
 
- Public Types inherited from coil::log_stream< _CharT, _Traits >
typedef _CharT char_type
 
typedef coil::Guard< MutexGuard
 
typedef coil::Mutex Mutex
 
typedef std::basic_ostream< char_type, traits_typeostream_type
 
typedef std::basic_streambuf< char_type, traits_typestreambuf_type
 
typedef _Traits traits_type
 

Public Member Functions

 Logger (const char *name="")
 Constructor. More...
 
 Logger (LogStreamBuf *streambuf)
 Constructor. More...
 
void setDateFormat (const char *format)
 Set date/time format for adding the header. More...
 
bool setLevel (const char *level)
 Set log level by string. More...
 
void setName (const char *name)
 Set suffix of date/time string of header. More...
 
virtual ~Logger (void)
 Virtual destructor. More...
 
- Public Member Functions inherited from coil::log_stream< _CharT, _Traits >
void disableLock ()
 Disable the lock mode. More...
 
void enableLock ()
 Enable the lock mode. More...
 
int getLevel () const
 Get the log level. More...
 
bool isValid (int level) const
 Log level effective check. More...
 
ostream_typelevel (int level)
 Acquire log stream. More...
 
void lock ()
 Acquire log lock Acquire log lock when the lock mode is set. More...
 
 log_stream (streambuf_type *sb, int levelmin, int levelmax, int level)
 Constructor. More...
 
bool setLevel (int level)
 Set the log level. More...
 
void unlock ()
 Release the log lock Release the log lock when the lock mode is set. More...
 

Protected Member Functions

std::string getDate (void)
 Get the current formatted date/time string Get the current datetime described by specified format. More...
 
virtual void header (int level)
 Message prefix appender function. More...
 
int strToLevel (const char *level)
 Set the log level Set the log level corresponding to the given string. More...
 
- Protected Member Functions inherited from coil::log_stream< _CharT, _Traits >
 log_stream ()
 Default constructor. More...
 
 log_stream (const log_stream &x)
 Copy Constructor. More...
 
log_streamoperator= (const log_stream &x)
 Assignment operator. More...
 
 ~log_stream ()
 Destructor. More...
 

Private Attributes

std::string m_dateFormat
 
int m_msEnable
 
std::string m_name
 
int m_usEnable
 

Static Private Attributes

static const char * m_levelString []
 

Additional Inherited Members

- Static Public Attributes inherited from coil::log_stream< _CharT, _Traits >
static bool m_lockEnable = true
 Lock enable mode. More...
 
static Mutex m_mutex
 Mutual exclusion object. More...
 

Detailed Description

Logger class.

This class is composed of the buffer class and the format class.

Definition at line 99 of file SystemLogger.h.

Member Enumeration Documentation

anonymous enum
Enumerator
RTL_SILENT 
RTL_FATAL 
RTL_ERROR 
RTL_WARN 
RTL_INFO 
RTL_DEBUG 
RTL_TRACE 
RTL_VERBOSE 
RTL_PARANOID 

Definition at line 103 of file SystemLogger.h.

Constructor & Destructor Documentation

Logger::Logger ( const char *  name = "")

Constructor.

Constructor

Parameters
namesuffix of date/time string of header.

Definition at line 41 of file SystemLogger.cpp.

Logger::Logger ( LogStreamBuf streambuf)

Constructor.

Constructor

Parameters
streambufLogStream object

Definition at line 52 of file SystemLogger.cpp.

Logger::~Logger ( void  )
virtual

Virtual destructor.

Definition at line 62 of file SystemLogger.cpp.

Member Function Documentation

std::string Logger::getDate ( void  )
protected

Get the current formatted date/time string Get the current datetime described by specified format.

Get the current formatted date/time string.

Returns
Format specification current datetime

Definition at line 123 of file SystemLogger.cpp.

void Logger::header ( int  level)
protectedvirtual

Message prefix appender function.

Subclasses of this class should override this operation, and this function should be defined to append some prefix to the log messages.

Reimplemented from coil::log_stream< _CharT, _Traits >.

Reimplemented in Tests::LoggerMock.

Definition at line 111 of file SystemLogger.cpp.

void Logger::setDateFormat ( const char *  format)

Set date/time format for adding the header.

The format specification string is as follows:

%a abbreviated weekday name 
%A full weekday name 
%b abbreviated month name 
%B full month name 
%c the standard date and time string 
%d day of the month, as a number (1-31) 
%H hour, 24 hour format (0-23) 
%I hour, 12 hour format (1-12) 
%j day of the year, as a number (1-366) 
%m month as a number (1-12).
   Note: some versions of Microsoft Visual C++ may use values that range
   from 0-11. 
%M minute as a number (0-59) 
%p locale's equivalent of AM or PM 
%Q millisecond as a number (0-999) from ver 1.1
%q microsecond as a number (0-999) from ver 1.1
%S second as a number (0-59) 
%U week of the year, sunday as the first day 
%w weekday as a decimal (0-6, sunday=0) 
%W week of the year, monday as the first day 
%x standard date string 
%X standard time string 
%y year in decimal, without the century (0-99) 
%Y year in decimal, with the century 
%Z time zone name 
%% a percent sign 
Parameters
fmtDatetime format

Definition at line 85 of file SystemLogger.cpp.

bool Logger::setLevel ( const char *  level)

Set log level by string.

Parameters
levellog level

Definition at line 73 of file SystemLogger.cpp.

void Logger::setName ( const char *  name)

Set suffix of date/time string of header.

Set the suffix string added after the datatime of the header.

Parameters
suffixSuffix string

Definition at line 99 of file SystemLogger.cpp.

int Logger::strToLevel ( const char *  level)
protected

Set the log level Set the log level corresponding to the given string.

Set the log level.

Parameters
lvLog level string
Returns
The set log level

Definition at line 171 of file SystemLogger.cpp.

Member Data Documentation

std::string RTC::Logger::m_dateFormat
private

Definition at line 341 of file SystemLogger.h.

const char * Logger::m_levelString
staticprivate
Initial value:
=
{
" SILENT: ",
" FATAL: ",
" ERROR: ",
" WARNING: ",
" INFO: ",
" DEBUG: ",
" TRACE: ",
" VERBOSE: ",
" PARANOID: "
}

Definition at line 342 of file SystemLogger.h.

int RTC::Logger::m_msEnable
private

Definition at line 343 of file SystemLogger.h.

std::string RTC::Logger::m_name
private

Definition at line 340 of file SystemLogger.h.

int RTC::Logger::m_usEnable
private

Definition at line 344 of file SystemLogger.h.


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


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:08:03