51 #define ULOGGER_LOG(level, ...) ULogger::write(level, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__) 53 #define ULOGGER_DEBUG(...) ULOGGER_LOG(ULogger::kDebug, __VA_ARGS__) 54 #define ULOGGER_INFO(...) ULOGGER_LOG(ULogger::kInfo, __VA_ARGS__) 55 #define ULOGGER_WARN(...) ULOGGER_LOG(ULogger::kWarning, __VA_ARGS__) 56 #define ULOGGER_ERROR(...) ULOGGER_LOG(ULogger::kError, __VA_ARGS__) 57 #define ULOGGER_FATAL(...) ULOGGER_LOG(ULogger::kFatal, __VA_ARGS__) // Throw UException 59 #define UDEBUG(...) ULOGGER_DEBUG(__VA_ARGS__) 60 #define UINFO(...) ULOGGER_INFO(__VA_ARGS__) 61 #define UWARN(...) ULOGGER_WARN(__VA_ARGS__) 62 #define UERROR(...) ULOGGER_ERROR(__VA_ARGS__) 63 #define UFATAL(...) ULOGGER_FATAL(__VA_ARGS__) // Throw UException 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) 244 enum Type{kTypeNoLog, kTypeConsole, kTypeFile};
252 enum Level{kDebug, kInfo, kWarning, kError, kFatal};
265 static void setType(
Type type,
const std::string &fileName = kDefaultLogFileName,
bool append =
true);
325 static void setBuffered(
bool buffered);
355 static void setTreadIdFilter(
const std::vector<std::string> & ids);
362 static void registerCurrentThread(
const std::string &
name);
363 static void unregisterCurrentThread();
364 static std::map<std::string, unsigned long> getRegisteredThreads();
383 static void write(
const char* msg, ...);
397 const char *
function,
406 static int getTime(std::string &timeStr);
475 virtual void _write(
const char*, va_list) {}
556 static const char * levelName_[5];
static void setPrintThreadId(bool printThreadId)
static const std::string kDefaultLogFileName
static void setPrintLevel(bool printLevel)
static std::map< std::string, unsigned long > registeredThreads_
static std::string bufferedMsgs_
static bool printThreadID_
static bool printEndline_
static bool limitWhereLength_
static ULogger * instance_
static ULogger::Level eventLevel()
static void setTreadIdFilter(const std::set< unsigned long > &ids)
static void setLevel(ULogger::Level level)
static bool isPrintLevel()
virtual void _writeStr(const char *)
static bool printWhereFullPath_
static void setPrintTime(bool printTime)
const std::string & getMsg() const
static void setEventLevel(ULogger::Level eventSentLevel)
static void setPrintEndline(bool printEndline)
static const std::set< unsigned long > & getTreadIdFilter()
static std::string logFileName_
static bool printColored_
static void setPrintWhere(bool printWhere)
static void setPrintWhereFullPath(bool printWhereFullPath)
static ULogger::Level level()
static bool isPrintEndLine()
virtual std::string getClassName() const
static bool isPrintWhereFullPath()
ULogEvent(const std::string &msg, int level)
virtual void _write(const char *, va_list)
static bool isPrintWhere()
static bool isPrintColored()
Base * createInstance(const std::string &derived_class_name, ClassLoader *loader)
static bool isPrintThreadId()
static bool isPrintTime()
static UDestroyer< ULogger > destroyer_
static std::set< unsigned long > threadIdFilter_
static UMutex loggerMutex_
static void setPrintColored(bool printColored)