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.
 
 

26 lines
902 B

#ifndef JSONPARSER
#define JSONPARSER
#include "include/parser/IParser.h"
#include <QJsonValue>
class JsonParser : public IParser
{
public:
Log_ptr parse(const QString& input) const override;
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