#ifndef LINBOLOGGER_H
#define LINBOLOGGER_H
#include <QObject>
#include <QtDebug>
#include <QDateTime>
class LinboLogger : public QObject
{
Q_OBJECT
Q_PROPERTY(LinboLog latestLog READ getLatestLog NOTIFY latestLogChanged)
public:
friend class LinboBackend;
enum LinboLogType {
UnknownLogType = -1,
StdOut,
StdErr,
LinboGuiInfo,
LinboGuiError
};
typedef struct {
QString message;
LinboLogType type;
QDateTime time;
} LinboLog;
const LinboLog& getLatestLog();
static QString logTypeToString(LinboLogType logType);
private:
explicit LinboLogger(QObject *parent = nullptr);
void log(QString logText, LinboLogType logType);
QList<LinboLog> logHistory;
signals:
void latestLogChanged(const LinboLogger::LinboLog& latestLog);
#endif // LINBOLOGGER_H