23 #define snprintf _snprintf 43 RTL_SILENT, RTL_PARANOID, RTL_SILENT),
44 m_name(name), m_dateFormat(
"%b %d %H:%M:%S.%Q"),
45 m_msEnable(0), m_usEnable(0)
125 const int maxsize = 256;
133 date = gmtime(&timer);
136 std::string fmt(buf);
142 _snprintf(msec, 4,
"%03d", (
int)(tm.
usec() / 1000));
144 snprintf(msec, 4,
"%03d", (
int)(tm.
usec() / 1000));
152 _snprintf(usec, 4,
"%03d",
153 (
int)(tm.
usec() - ((tm.
usec() / 1000) * 1000)));
155 snprintf(usec, 4,
"%03d",
156 (
int)(tm.
usec() - ((tm.
usec() / 1000) * 1000)));
173 std::string lv(level);
176 else if (lv ==
"FATAL")
178 else if (lv ==
"ERROR")
180 else if (lv ==
"WARN")
182 else if (lv ==
"INFO")
184 else if (lv ==
"DEBUG")
186 else if (lv ==
"TRACE")
188 else if (lv ==
"VERBOSE")
190 else if (lv ==
"PARANOID")
void setDateFormat(const char *format)
Set date/time format for adding the header.
virtual ~Logger(void)
Virtual destructor.
virtual void header(int level)
Message prefix appender function.
long int sec() const
Get value of second time scale.
log_streambuf template class
RT component logger class.
void setName(const char *name)
Set suffix of date/time string of header.
static Manager & instance()
Get instance of the manager.
RTComponent manager class.
int gettimeofday(struct timeval *tv, struct timezone *tz)
Get the time and timezone.
log_stream template class
bool setLevel(int level)
Set the log level.
unsigned int replaceString(std::string &str, const std::string from, const std::string to)
Replace string.
bool setLevel(const char *level)
Set log level by string.
ostream_type & level(int level)
Acquire log stream.
Logger(const char *name="")
Constructor.
int strToLevel(const char *level)
Set the log level Set the log level corresponding to the given string.
long int usec() const
Get value of micro second time scale.
static const char * m_levelString[]
std::string getDate(void)
Get the current formatted date/time string Get the current datetime described by specified format...
Common Object Interface Layer.