|
|
@ -30,6 +30,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include <QJsonArray> |
|
|
|
#include <QJsonArray> |
|
|
|
#include <QJsonObject> |
|
|
|
#include <QJsonObject> |
|
|
|
|
|
|
|
#include <QVector> |
|
|
|
|
|
|
|
|
|
|
|
#include "base/global.h" |
|
|
|
#include "base/global.h" |
|
|
|
#include "base/logger.h" |
|
|
|
#include "base/logger.h" |
|
|
@ -75,18 +76,18 @@ void LogController::mainAction() |
|
|
|
|
|
|
|
|
|
|
|
for (const Log::Msg &msg : asConst(logger->getMessages(lastKnownId))) |
|
|
|
for (const Log::Msg &msg : asConst(logger->getMessages(lastKnownId))) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!((msg.type == Log::NORMAL && isNormal) |
|
|
|
if (!(((msg.type == Log::NORMAL) && isNormal) |
|
|
|
|| (msg.type == Log::INFO && isInfo) |
|
|
|
|| ((msg.type == Log::INFO) && isInfo) |
|
|
|
|| (msg.type == Log::WARNING && isWarning) |
|
|
|
|| ((msg.type == Log::WARNING) && isWarning) |
|
|
|
|| (msg.type == Log::CRITICAL && isCritical))) |
|
|
|
|| ((msg.type == Log::CRITICAL) && isCritical))) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
msgList.append(QJsonObject |
|
|
|
msgList.append(QJsonObject |
|
|
|
{ |
|
|
|
{ |
|
|
|
{KEY_LOG_ID, msg.id}, |
|
|
|
{QLatin1String(KEY_LOG_ID), msg.id}, |
|
|
|
{KEY_LOG_TIMESTAMP, msg.timestamp}, |
|
|
|
{QLatin1String(KEY_LOG_TIMESTAMP), msg.timestamp}, |
|
|
|
{KEY_LOG_MSG_TYPE, msg.type}, |
|
|
|
{QLatin1String(KEY_LOG_MSG_TYPE), msg.type}, |
|
|
|
{KEY_LOG_MSG_MESSAGE, msg.message} |
|
|
|
{QLatin1String(KEY_LOG_MSG_MESSAGE), msg.message} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -105,10 +106,8 @@ void LogController::mainAction() |
|
|
|
// - last_known_id (int): exclude messages with id <= 'last_known_id' (default -1)
|
|
|
|
// - last_known_id (int): exclude messages with id <= 'last_known_id' (default -1)
|
|
|
|
void LogController::peersAction() |
|
|
|
void LogController::peersAction() |
|
|
|
{ |
|
|
|
{ |
|
|
|
int lastKnownId; |
|
|
|
bool ok = false; |
|
|
|
bool ok; |
|
|
|
int lastKnownId = params()["last_known_id"].toInt(&ok); |
|
|
|
|
|
|
|
|
|
|
|
lastKnownId = params()["last_known_id"].toInt(&ok); |
|
|
|
|
|
|
|
if (!ok) |
|
|
|
if (!ok) |
|
|
|
lastKnownId = -1; |
|
|
|
lastKnownId = -1; |
|
|
|
|
|
|
|
|
|
|
@ -119,11 +118,11 @@ void LogController::peersAction() |
|
|
|
{ |
|
|
|
{ |
|
|
|
peerList.append(QJsonObject |
|
|
|
peerList.append(QJsonObject |
|
|
|
{ |
|
|
|
{ |
|
|
|
{KEY_LOG_ID, peer.id}, |
|
|
|
{QLatin1String(KEY_LOG_ID), peer.id}, |
|
|
|
{KEY_LOG_TIMESTAMP, peer.timestamp}, |
|
|
|
{QLatin1String(KEY_LOG_TIMESTAMP), peer.timestamp}, |
|
|
|
{KEY_LOG_PEER_IP, peer.ip}, |
|
|
|
{QLatin1String(KEY_LOG_PEER_IP), peer.ip}, |
|
|
|
{KEY_LOG_PEER_BLOCKED, peer.blocked}, |
|
|
|
{QLatin1String(KEY_LOG_PEER_BLOCKED), peer.blocked}, |
|
|
|
{KEY_LOG_PEER_REASON, peer.reason} |
|
|
|
{QLatin1String(KEY_LOG_PEER_REASON), peer.reason} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|