Go to the documentation of this file.
35 #define COLOR_NORMAL FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED
36 #define COLOR_RED FOREGROUND_RED | FOREGROUND_INTENSITY
37 #define COLOR_GREEN FOREGROUND_GREEN
38 #define COLOR_YELLOW FOREGROUND_GREEN | FOREGROUND_RED
40 #define COLOR_NORMAL "\033[0m"
41 #define COLOR_RED "\033[31m"
42 #define COLOR_GREEN "\033[32m"
43 #define COLOR_YELLOW "\033[33m"
137 std::ofstream fileToClear(
fileName_.c_str(), std::ios::out);
149 printf(
"FileLogger : Cannot open file : %s\n",
fileName_.c_str());
208 for(
unsigned int i=0;
i<ids.size();++
i)
233 if(
iter->second ==
id)
309 std::string endline =
"";
314 std::string
time =
"";
363 const char *
function,
392 const char* color =
NULL;
413 std::string endline =
"";
418 std::string
time =
"";
426 std::string levelStr =
"";
429 const int bufSize = 30;
430 char buf[bufSize] = {0};
438 levelStr.append(
" ");
447 std::string whereStr =
"";
454 whereStr.append(
file);
462 fileName.append(
"~");
464 whereStr.append(fileName);
468 whereStr.append(
":");
470 whereStr.append(lineStr);
473 whereStr.append(
"::");
474 std::string funcStr =
function;
480 funcStr.append(
"()");
481 whereStr.append(funcStr);
483 whereStr.append(
" ");
492 HANDLE
H = GetStdHandle(STD_OUTPUT_HANDLE);
497 SetConsoleTextAttribute(
H,color);
554 std::string fullMsg =
uFormat(
"%s%s%s%s", levelStr.c_str(), pidStr.c_str(),
time.c_str(), whereStr.c_str());
572 std::string fullMsg =
uFormat(
"%s%s%s%s", levelStr.c_str(), pidStr.c_str(),
time.c_str(), whereStr.c_str());
596 const int bufSize = 30;
597 char buf[bufSize] = {0};
602 localtime_s (&timeinfo, &rawtime );
603 int result = sprintf_s(buf, bufSize,
"%d-%s%d-%s%d %s%d:%s%d:%s%d",
604 timeinfo.tm_year+1900,
605 (timeinfo.tm_mon+1) < 10 ?
"0":
"", timeinfo.tm_mon+1,
606 (timeinfo.tm_mday) < 10 ?
"0":
"", timeinfo.tm_mday,
607 (timeinfo.tm_hour) < 10 ?
"0":
"", timeinfo.tm_hour,
608 (timeinfo.tm_min) < 10 ?
"0":
"", timeinfo.tm_min,
609 (timeinfo.tm_sec) < 10 ?
"0":
"", timeinfo.tm_sec);
613 timeinfo = *localtime (&rawtime);
614 int result = snprintf(buf, bufSize,
"%d-%s%d-%s%d %s%d:%s%d:%s%d",
615 timeinfo.tm_year+1900,
616 (timeinfo.tm_mon+1) < 10 ?
"0":
"", timeinfo.tm_mon+1,
617 (timeinfo.tm_mday) < 10 ?
"0":
"", timeinfo.tm_mday,
618 (timeinfo.tm_hour) < 10 ?
"0":
"", timeinfo.tm_hour,
619 (timeinfo.tm_min) < 10 ?
"0":
"", timeinfo.tm_min,
620 (timeinfo.tm_sec) < 10 ?
"0":
"", timeinfo.tm_sec);
622 struct timeval rawtime;
623 gettimeofday(&rawtime,
NULL);
624 localtime_r (&rawtime.tv_sec, &timeinfo);
625 int result = snprintf(buf, bufSize,
"%d-%s%d-%s%d %s%d:%s%d:%s%d.%s%d",
626 timeinfo.tm_year+1900,
627 (timeinfo.tm_mon+1) < 10 ?
"0":
"", timeinfo.tm_mon+1,
628 (timeinfo.tm_mday) < 10 ?
"0":
"", timeinfo.tm_mday,
629 (timeinfo.tm_hour) < 10 ?
"0":
"", timeinfo.tm_hour,
630 (timeinfo.tm_min) < 10 ?
"0":
"", timeinfo.tm_min,
631 (timeinfo.tm_sec) < 10 ?
"0":
"", timeinfo.tm_sec,
632 (rawtime.tv_usec/1000) < 10 ?
"00":(rawtime.tv_usec/1000) < 100?
"0":
"",
int(rawtime.tv_usec/1000));
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[ *:*] noreverse nowriteback set trange[ *:*] noreverse nowriteback set urange[ *:*] noreverse nowriteback set vrange[ *:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
static const std::string kDefaultLogFileName
static std::set< unsigned long > threadIdFilter_
virtual void _writeStr(const char *msg)
static std::map< std::string, unsigned long > registeredThreads_
static unsigned long currentThreadId()
std::string UTILITE_EXPORT uFormatv(const char *fmt, va_list ap)
static bool printThreadID_
static ULogger * instance_
static std::string bufferedMsgs_
static void unregisterCurrentThread()
static bool printEndline_
static bool limitWhereLength_
static void setTreadIdFilter(const std::set< unsigned long > &ids)
static std::map< std::string, unsigned long > getRegisteredThreads()
void uInsert(std::map< K, V > &map, const std::pair< K, V > &pair)
static const char * levelName_[5]
static ULogger * createInstance()
static void setBuffered(bool buffered)
std::string UTILITE_EXPORT uNumber2Str(unsigned int number)
Some conversion functions.
virtual void _writeStr(const char *msg)
virtual void _writeStr(const char *)
static bool printWhereFullPath_
static std::string logFileName_
#define UASSERT(condition)
static void setType(Type type, const std::string &fileName=kDefaultLogFileName, bool append=true)
virtual void _write(const char *, va_list)
bool setDoomed(T *doomed)
std::ofstream out("Result.txt")
static ULogger * getInstance()
std::string UTILITE_EXPORT uFormat(const char *fmt,...)
static ULogger::Level level()
static void registerCurrentThread(const std::string &name)
std::string fileName_
the file name
ULogger class and convenient macros.
static int getTime(std::string &timeStr)
static void write(const char *msg,...)
iterator iter(handle obj)
static bool printColored_
virtual ~UConsoleLogger()
Wrappers of STL for convenient functions.
UFileLogger(const std::string &fileName, bool append)
static void post(UEvent *event, bool async=true, const UEventsSender *sender=0)
static UDestroyer< ULogger > destroyer_
std::string bufferedMsgs_
static UMutex loggerMutex_
virtual void _write(const char *msg, va_list arg)
virtual void _write(const char *msg, va_list arg)
rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:23