#pragma once #include #include #include #include #include #include namespace hex::pl { class ASTNode; class LogConsole { public: enum Level { Debug, Info, Warning, Error }; [[nodiscard]] const auto& getLog() const { return this->m_consoleLog; } using EvaluateError = std::pair; void log(Level level, const std::string &message); [[noreturn]] static void abortEvaluation(const std::string &message); [[noreturn]] static void abortEvaluation(const std::string &message, const ASTNode *node); void clear(); void setHardError(const EvaluateError &error) { this->m_lastHardError = error; } [[nodiscard]] const std::optional& getLastHardError() { return this->m_lastHardError; }; private: std::vector> m_consoleLog; std::optional m_lastHardError; }; }