Go to the documentation of this file.
26 #include "../global.h"
42 MAX_LOG_HISTORY = 1000
45 typedef std::function<void(
Fw::LogLevel,
const std::string&,
int64)> OnLogCallback;
59 void setOnLog(
const OnLogCallback& onLog) { m_onLog = onLog; }
62 std::list<LogMessage> m_logMessages;
63 OnLogCallback m_onLog;
64 std::ofstream m_outFile;
65 std::recursive_mutex m_mutex;
70 #define trace() logFunc(Fw::LogDebug, "", __PRETTY_FUNCTION__)
71 #define traceDebug(a) logFunc(Fw::LogDebug, a, __PRETTY_FUNCTION__)
72 #define traceInfo(a) logFunc(Fw::LogInfo, a, __PRETTY_FUNCTION__)
73 #define traceWarning(a) logFunc(Fw::LogWarning, a, __PRETTY_FUNCTION__)
74 #define traceError(a) logFunc(Fw::LogError, a, __PRETTY_FUNCTION__)
76 #define logTraceCounter() { \
77 static int __count = 0; \
78 static Timer __timer; \
80 if(__timer.ticksElapsed() >= 1000) { \
81 logTraceDebug(__count); \
87 #define logTraceFrameCounter() { \
88 static int __count = 0; \
89 static Timer __timer; \
91 if(__timer.ticksElapsed() > 0) { \
92 logTraceDebug(__count); \
void error(const std::string &what)
void setOnLog(const OnLogCallback &onLog)
void fatal(const std::string &what)
void log(Fw::LogLevel level, const std::string &message)
void logFunc(Fw::LogLevel level, const std::string &message, std::string prettyFunction)
void debug(const std::string &what)
void setLogFile(const std::string &file)
LogMessage(Fw::LogLevel level, const std::string &message, std::size_t when)
void info(const std::string &what)
void warning(const std::string &what)