Implemented `EventWindow` for viewing events with pagination and table-based UI. Added database migration to remove `UNIQUE` constraint on `external_id` in `events`. Enhanced DAO methods for event retrieval, pagination, and transaction updates. Integrated OCR recognition in transaction scripts and streamlined event handling in services.
36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
#include "AppLogger.h"
|
|
|
|
#include <QDateTime>
|
|
#include <QMetaObject>
|
|
|
|
#include "dao/AppLogDAO.h"
|
|
#include "db/AppLogEntry.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) {
|
|
AppLogEntry entry;
|
|
entry.source = source;
|
|
entry.deviceId = deviceId;
|
|
entry.message = message;
|
|
entry.screenshot = screenshot;
|
|
entry.timestamp = QDateTime::currentDateTimeUtc();
|
|
AppLogDAO::insert(entry);
|
|
|
|
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));
|
|
}
|
|
}
|