Skip to content
Snippets Groups Projects
Commit e87f12d4 authored by littletux89@gmail.com's avatar littletux89@gmail.com
Browse files

[+] Added class reading log nodes.

parent 6b9158a6
No related branches found
No related tags found
No related merge requests found
#include "DapLogReader.h"
DapLogReader::DapLogReader(QObject *parent) : QObject(parent)
{
}
QList<QString> DapLogReader::request(int aiTimeStamp, int aiRowCount)
{
QList<QString> str;
QByteArray result;
QProcess process;
process.start(QString("%1 print_log ts_after %2 limit %3").arg("/home/andrey/Demlabs/build-kelvin-node/kelvin-node-cli").arg(aiTimeStamp).arg(aiRowCount));
process.waitForFinished(-1);
result = process.readAll();
if(result.isEmpty())
qDebug() << "FALSE";
else
{
qDebug() << "TRUE";
qDebug() << QString::fromLatin1(result);
}
return str;
}
#ifndef DAPLOGREADER_H
#define DAPLOGREADER_H
#include <QObject>
#include <QString>
#include <QProcess>
#include <QDebug>
class DapLogReader : public QObject
{
Q_OBJECT
public:
explicit DapLogReader(QObject *parent = nullptr);
signals:
public slots:
QList<QString> request(int aiTimeStamp, int aiRowCount);
};
#endif // DAPLOGREADER_H
......@@ -40,12 +40,14 @@ SOURCES += \
main.cpp \
DapChainDashboardService.cpp \
DapChainNode.cpp \
DapChainNodeCache.cpp
DapChainNodeCache.cpp \
DapLogReader.cpp
HEADERS += \
DapChainDashboardService.h \
DapChainNode.h \
DapChainNodeCache.h
DapChainNodeCache.h \
DapLogReader.h
include (../libdap-qt/libdap-qt.pri)
include (../libKelvinDashboardCommon/libKelvinDashboardCommon.pri)
......
......@@ -5,6 +5,7 @@
#include "DapHalper.h"
#include "DapChainDashboardService.h"
#include "DapLogger.h"
#include "DapLogReader.h"
int main(int argc, char *argv[])
{
......@@ -26,7 +27,7 @@ int main(int argc, char *argv[])
a.setOrganizationName("DEMLABS");
a.setOrganizationDomain("demlabs.com");
a.setApplicationName("KelvinDashboardService");
DapLogger dapLogger;
/// TODO: The code is commented out at the time of developing the logging strategy in the project
//#ifndef QT_DEBUG
......@@ -34,7 +35,10 @@ int main(int argc, char *argv[])
dapLogger.setLogFile(QString("/opt/%1/log/%2Service.log").arg(QString(DAP_BRAND)).arg(DAP_BRAND));
#endif
//#endif
DapLogReader dapLogReader;
auto var = dapLogReader.request(0, 100);
auto var1 = dapLogReader.request(1, 100);
auto var2 = dapLogReader.request(2, 100);
// Creating the main application object
DapChainDashboardService service;
service.start();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment