1
0
forked from BRT/arc
arc/services/AppLogger.cpp
trnsmkot abbf811ac9 - Remove app_logs table and related logic, transitioning to general_logs.
- Add `pinCheckOnly` parameter in scripts to support conditional account checks.
- Prevent activation of bank profiles without active cards in `AccountSettingsWindow` and `DeviceWidget`.
- Adjust logging flow in `AppLogger` for unified data handling.
2026-03-31 14:07:23 +07:00

32 lines
1004 B
C++

#include "AppLogger.h"
#include <QDateTime>
#include <QMetaObject>
#include "dao/GeneralLogDAO.h"
#include "net/NetworkService.h"
NetworkService *AppLogger::s_networkService = nullptr;
void AppLogger::setNetworkService(NetworkService *service) {
s_networkService = service;
}
void AppLogger::log(const QString &source, const QString &deviceId,
const QString &message, const QByteArray &screenshot,
const QString &event) {
const QString fullMessage = deviceId.isEmpty()
? message
: QString("[%1] %2").arg(deviceId, message);
GeneralLogDAO::insert("WARNING", source, fullMessage, screenshot);
if (s_networkService) {
QMetaObject::invokeMethod(s_networkService, "postMonitoringLog",
Qt::QueuedConnection,
Q_ARG(QString, QStringLiteral("ERROR")),
Q_ARG(QString, event.isEmpty() ? source : event),
Q_ARG(QString, message),
Q_ARG(QByteArray, screenshot));
}
}