Log Viewer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
894 B

6 months ago
#ifndef JSONPARSER
#define JSONPARSER
#include "parser/IParser.h"
6 months ago
#include <QJsonValue>
class JsonParser : public IParser
{
public:
Log_ptr parse(const QString& input) const override;
6 months ago
private:
QJsonObject parseJson(const QString& input) const;
std::optional<QString> extractId(const QJsonValue& value) const;
std::optional<ELogLevel> extractLevel(const QJsonValue& value) const;
std::optional<SourceLocationDto> extractSource(const QJsonValue& value) const;
std::optional<QList<MessagePart> > extractMessages(const QJsonValue& value) const;
std::optional<QString> extractScope(const QJsonValue& value) const;
std::optional<qint64> extractThreadId(const QJsonValue& value) const;
std::optional<QDateTime> extractTimestamp(const QJsonValue& value) const;
std::optional<MessagePart> parseMessage(const QJsonValue& value) const;
};
#endif //JSONPARSER