diff -r 87ee9824210b -r 7ef03c2b46ab src/basics.h --- a/src/basics.h Mon Jun 20 16:59:09 2022 +0300 +++ b/src/basics.h Mon Jun 20 17:27:30 2022 +0300 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -295,3 +296,25 @@ template using Graph = std::deque>; + +struct Message +{ + QDateTime time; + enum { Info, Warning, Error } type; + QString text; +}; + +inline Message logInfo(const QString text) +{ + return Message{.time = QDateTime::currentDateTime(), .type = Message::Info, .text = text}; +} + +inline Message logWarning(const QString text) +{ + return Message{.time = QDateTime::currentDateTime(), .type = Message::Warning, .text = text}; +} + +inline Message logError(const QString text) +{ + return Message{.time = QDateTime::currentDateTime(), .type = Message::Error, .text = text}; +}