OpenRTM
1.0.0
|
#include <SystemLogger.h>
Public Types | |
enum | { RTL_SILENT, RTL_FATAL, RTL_ERROR, RTL_WARN, RTL_INFO, RTL_DEBUG, RTL_TRACE, RTL_VERBOSE, RTL_PARANOID } |
![]() | |
typedef _CharT | char_type |
typedef _Traits | traits_type |
typedef std::basic_ostream < char_type, traits_type > | ostream_type |
typedef std::basic_streambuf < char_type, traits_type > | streambuf_type |
typedef coil::Mutex | Mutex |
typedef coil::Guard< Mutex > | Guard |
Public Member Functions | |
Logger (const char *name="") | |
Constructor. | |
Logger (LogStreamBuf *streambuf) | |
Constructor. | |
virtual | ~Logger (void) |
Virtual destructor. | |
bool | setLevel (const char *level) |
Set log level by string. | |
void | setDateFormat (const char *format) |
Set date/time format for adding the header. | |
void | setName (const char *name) |
Set suffix of date/time string of header. | |
![]() | |
log_stream (streambuf_type *sb, int levelmin, int levelmax, int level) | |
Constructor. | |
bool | setLevel (int level) |
Set the log level. | |
int | getLevel () const |
Get the log level. | |
void | enableLock () |
void | disableLock () |
ostream_type & | level (int level) |
Acquire log stream. | |
bool | isValid (int level) const |
Log level effective check. | |
void | lock () |
Acquire log lock Acquire log lock when the lock mode is set. | |
void | unlock () |
Release the log lock Release the log lock when the lock mode is set. |
Protected Member Functions | |
virtual void | header (int level) |
Message prefix appender function. | |
std::string | getDate (void) |
Get the current formatted date/time string Get the current datetime described by specified format. | |
int | strToLevel (const char *level) |
Set the log level Set the log level corresponding to the given string. | |
![]() | |
~log_stream () | |
Destructor. | |
log_stream () | |
Default constructor. | |
log_stream (const log_stream &x) | |
Copy Constructor. | |
log_stream & | operator= (const log_stream &x) |
Assignment operator. |
Additional Inherited Members | |
![]() | |
static bool | m_lockEnable = true |
Lock enable mode. | |
static Mutex | m_mutex |
Mutual exclusion object. |
Logger class.
This class is composed of the buffer class and the format class.
anonymous enum |
RTC::Logger::Logger | ( | const char * | name = "" | ) |
Constructor.
Constructor
name | suffix of date/time string of header. |
RTC::Logger::Logger | ( | LogStreamBuf * | streambuf | ) |
Constructor.
Constructor
streambuf | LogStream object |
|
virtual |
Virtual destructor.
|
protected |
Get the current formatted date/time string Get the current datetime described by specified format.
|
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 >.
void RTC::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
fmt | Datetime format |
bool RTC::Logger::setLevel | ( | const char * | level | ) |
Set log level by string.
level | log level |
void RTC::Logger::setName | ( | const char * | name | ) |
Set suffix of date/time string of header.
Set the suffix string added after the datatime of the header.
suffix | Suffix string |
|
protected |
Set the log level Set the log level corresponding to the given string.
lv | Log level string |