#ifndef MALACHSCRIPT_LOGGER_HPP #define MALACHSCRIPT_LOGGER_HPP #include #include "Diagnostic.hpp" namespace MalachScript::Diagnostics { class Logger { std::vector _messages; public: inline void Log(DiagnosticLevel level, DiagnosticType type, std::string_view scriptName, TextSpan span, const std::vector& formats = {}) { _messages.emplace_back(level, type, scriptName, span, formats); } inline void LogTrace(DiagnosticType type, std::string_view scriptName, TextSpan span) { Log(DiagnosticLevel::Trace, type, scriptName, span); } inline void LogInfo(DiagnosticType type, std::string_view scriptName, TextSpan span) { Log(DiagnosticLevel::Information, type, scriptName, span); } inline void LogWarning(DiagnosticType type, std::string_view scriptName, TextSpan span) { Log(DiagnosticLevel::Warning, type, scriptName, span); } inline void LogError(DiagnosticType type, std::string_view scriptName, TextSpan span, const std::vector& formats = {}) { Log(DiagnosticLevel::Error, type, scriptName, span, formats); } inline void LogCritical(DiagnosticType type, std::string_view scriptName, TextSpan span) { Log(DiagnosticLevel::Critical, type, scriptName, span); } [[nodiscard]] const std::vector& GetMessages() const noexcept { return _messages; } }; } #endif // MALACHSCRIPT_LOGGER_HPP