mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-20 19:08:30 +00:00
feat(src/app/logger/Logger): log thread
This commit is contained in:
parent
4e56e23cc0
commit
d0badaa4e2
1 changed files with 8 additions and 7 deletions
|
|
@ -23,6 +23,7 @@
|
||||||
#include <bctoolbox/logging.h>
|
#include <bctoolbox/logging.h>
|
||||||
#include <linphone/linphonecore.h>
|
#include <linphone/linphonecore.h>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
#include "../../Utils.hpp"
|
#include "../../Utils.hpp"
|
||||||
#include "../paths/Paths.hpp"
|
#include "../paths/Paths.hpp"
|
||||||
|
|
@ -43,7 +44,7 @@
|
||||||
#define PURPLE ""
|
#define PURPLE ""
|
||||||
#define RED ""
|
#define RED ""
|
||||||
#define RESET ""
|
#define RESET ""
|
||||||
#endif // ifdef __linux__
|
#endif // if defined(__linux__) || defined(__APPLE__)
|
||||||
|
|
||||||
#define QT_DOMAIN "qt"
|
#define QT_DOMAIN "qt"
|
||||||
|
|
||||||
|
|
@ -103,19 +104,19 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
|
||||||
BctbxLogLevel level;
|
BctbxLogLevel level;
|
||||||
|
|
||||||
if (type == QtDebugMsg) {
|
if (type == QtDebugMsg) {
|
||||||
format = GREEN "[%s][Debug]" PURPLE "%s" RESET "%s\n";
|
format = GREEN "[%s][%p][Debug]" PURPLE "%s" RESET "%s\n";
|
||||||
level = BCTBX_LOG_DEBUG;
|
level = BCTBX_LOG_DEBUG;
|
||||||
} else if (type == QtInfoMsg) {
|
} else if (type == QtInfoMsg) {
|
||||||
format = BLUE "[%s][Info]" PURPLE "%s" RESET "%s\n";
|
format = BLUE "[%s][%p][Info]" PURPLE "%s" RESET "%s\n";
|
||||||
level = BCTBX_LOG_MESSAGE;
|
level = BCTBX_LOG_MESSAGE;
|
||||||
} else if (type == QtWarningMsg) {
|
} else if (type == QtWarningMsg) {
|
||||||
format = RED "[%s][Warning]" PURPLE "%s" RESET "%s\n";
|
format = RED "[%s][%p][Warning]" PURPLE "%s" RESET "%s\n";
|
||||||
level = BCTBX_LOG_WARNING;
|
level = BCTBX_LOG_WARNING;
|
||||||
} else if (type == QtCriticalMsg) {
|
} else if (type == QtCriticalMsg) {
|
||||||
format = RED "[%s][Critical]" PURPLE "%s" RESET "%s\n";
|
format = RED "[%s][%p][Critical]" PURPLE "%s" RESET "%s\n";
|
||||||
level = BCTBX_LOG_ERROR;
|
level = BCTBX_LOG_ERROR;
|
||||||
} else if (type == QtFatalMsg) {
|
} else if (type == QtFatalMsg) {
|
||||||
format = RED "[%s][Fatal]" PURPLE "%s" RESET "%s\n";
|
format = RED "[%s][%p][Fatal]" PURPLE "%s" RESET "%s\n";
|
||||||
level = BCTBX_LOG_FATAL;
|
level = BCTBX_LOG_FATAL;
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|
@ -144,7 +145,7 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri
|
||||||
|
|
||||||
mMutex.lock();
|
mMutex.lock();
|
||||||
|
|
||||||
fprintf(stderr, format, dateTime.constData(), context_str, localMsg.constData());
|
fprintf(stderr, format, dateTime.constData(), QThread::currentThread(), context_str, localMsg.constData());
|
||||||
bctbx_log(QT_DOMAIN, level, "QT: %s%s", context_str, localMsg.constData());
|
bctbx_log(QT_DOMAIN, level, "QT: %s%s", context_str, localMsg.constData());
|
||||||
|
|
||||||
mMutex.unlock();
|
mMutex.unlock();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue