51 #include <QMutexLocker>
57 using namespace UTILSLIB;
67 #define COLOR_INFO SetConsoleTextAttribute(hOut, 0x02) //green
68 #define COLOR_DEBUG SetConsoleTextAttribute(hOut, 0x02) //green
69 #define COLOR_WARN SetConsoleTextAttribute(hOut, 0x0E) //yellow
70 #define COLOR_FATAL SetConsoleTextAttribute(hOut, 0x0E) //yellow
71 #define COLOR_CRITICAL SetConsoleTextAttribute(hOut, 0x04) //red
72 #define COLOR_RESET SetConsoleTextAttribute(hOut, 7) //reset
73 #define LOG_WRITE(OUTPUT, COLOR, LEVEL, MSG) COLOR; OUTPUT << LEVEL;COLOR_RESET; OUTPUT<< MSG << std::endl
76 #define COLOR_INFO "\033[32;1m" //green
77 #define COLOR_DEBUG "\033[32;1m" //green
78 #define COLOR_WARN "\033[33;1m" //yellow
79 #define COLOR_CRITICAL "\033[31;1m" //red
80 #define COLOR_FATAL "\033[33;1m" //yellow
81 #define COLOR_RESET "\033[0m" //reset
83 #define LOG_WRITE(OUTPUT, COLOR, LEVEL, MSG) OUTPUT << COLOR << LEVEL << COLOR_RESET << MSG << "\n"
86 std::mutex ApplicationLogger::m_mutex;
93 const QMessageLogContext &context,
98 QString sDate = QString(
"] ");
105 HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
111 LOG_WRITE(std::cout, COLOR_WARN, QString(
"[WARN%1").arg(sDate).toStdString(), msg.toStdString());
114 LOG_WRITE(std::cout, COLOR_CRITICAL, QString(
"[CRIT%1").arg(sDate).toStdString(), msg.toStdString());
117 LOG_WRITE(std::cout, COLOR_FATAL, QString(
"[FATAL%1").arg(sDate).toStdString(), msg.toStdString());
120 LOG_WRITE(std::cout, COLOR_DEBUG, QString(
"[DEBUG%1").arg(sDate).toStdString(), msg.toStdString());
123 LOG_WRITE(std::cout, COLOR_INFO, QString(
"[INFO%1").arg(sDate).toStdString(), msg.toStdString());
126 LOG_WRITE(std::cout, COLOR_RESET,
"", msg.toStdString());