52 #define ULOGGER_LOG(level, ...) ULogger::write(level, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) 54 #define ULOGGER_DEBUG(...) ULOGGER_LOG(ULogger::kDebug, __VA_ARGS__) 55 #define ULOGGER_INFO(...) ULOGGER_LOG(ULogger::kInfo, __VA_ARGS__) 56 #define ULOGGER_WARN(...) ULOGGER_LOG(ULogger::kWarning, __VA_ARGS__) 57 #define ULOGGER_ERROR(...) ULOGGER_LOG(ULogger::kError, __VA_ARGS__) 58 #define ULOGGER_FATAL(...) ULOGGER_LOG(ULogger::kFatal, __VA_ARGS__) 60 #define UDEBUG(...) ULOGGER_DEBUG(__VA_ARGS__) 61 #define UINFO(...) ULOGGER_INFO(__VA_ARGS__) 62 #define UWARN(...) ULOGGER_WARN(__VA_ARGS__) 63 #define UERROR(...) ULOGGER_ERROR(__VA_ARGS__) 64 #define UFATAL(...) ULOGGER_FATAL(__VA_ARGS__) 66 #define UASSERT(condition) if(!(condition)) ULogger::write(ULogger::kFatal, __FILE__, __LINE__, __FUNCTION__, "Condition (%s) not met!", #condition) 67 #define UASSERT_MSG(condition, msg_str) if(!(condition)) ULogger::write(ULogger::kFatal, __FILE__, __LINE__, __FUNCTION__, "Condition (%s) not met! [%s]", #condition, msg_str) 213 enum Type{kTypeNoLog, kTypeConsole, kTypeFile};
221 enum Level{kDebug, kInfo, kWarning, kError, kFatal};
234 static void setType(
Type type,
const std::string &fileName = kDefaultLogFileName,
bool append =
true);
287 static void setBuffered(
bool buffered);
339 static void write(
const char* msg, ...);
353 const char *
function,
362 static int getTime(std::string &timeStr);
431 virtual void _write(
const char* msg, va_list arg) {}
512 static const char * levelName_[5];
static const std::string kDefaultLogFileName
static void setPrintLevel(bool printLevel)
Base * createInstance(const std::string &derived_class_name, ClassLoader *loader)
virtual void _writeStr(const char *msg)
static std::string bufferedMsgs_
static bool printEndline_
static bool limitWhereLength_
static ULogger * instance_
static ULogger::Level eventLevel()
static void setLevel(ULogger::Level level)
static bool isPrintLevel()
static bool printWhereFullPath_
static void setPrintTime(bool printTime)
static void setEventLevel(ULogger::Level eventSentLevel)
static bool exitingState_
static void setPrintEndline(bool printEndline)
static ULogger::Level exitLevel()
static std::string logFileName_
static bool printColored_
static void setPrintWhere(bool printWhere)
static void setPrintWhereFullPath(bool printWhereFullPath)
static ULogger::Level level()
static bool isPrintEndLine()
static bool isPrintWhereFullPath()
static bool isPrintWhere()
static bool isPrintColored()
ROSCPP_DECL std::string append(const std::string &left, const std::string &right)
static bool isPrintTime()
static void setExitLevel(ULogger::Level exitLevel)
static UDestroyer< ULogger > destroyer_
static UMutex loggerMutex_
static void setPrintColored(bool printColored)
virtual void _write(const char *msg, va_list arg)