26 lines
1.1 KiB
C++
26 lines
1.1 KiB
C++
|
#ifndef ELOHIMSCRIPT_DIAGNOSTICS_HPP
|
||
|
#define ELOHIMSCRIPT_DIAGNOSTICS_HPP
|
||
|
|
||
|
#include <vector>
|
||
|
#include "Diagnostic.hpp"
|
||
|
|
||
|
namespace ElohimScript::Diagnostics {
|
||
|
class Diagnostics {
|
||
|
std::vector<Diagnostic> _messages;
|
||
|
|
||
|
public:
|
||
|
inline void Log(DiagnosticLevel level, DiagnosticType type, TextSpan span) {
|
||
|
_messages.emplace_back(level, type, span);
|
||
|
}
|
||
|
inline void LogTrace(DiagnosticType type, TextSpan span) { Log(DiagnosticLevel::Trace, type, span); }
|
||
|
inline void LogInfo(DiagnosticType type, TextSpan span) { Log(DiagnosticLevel::Information, type, span); }
|
||
|
inline void LogWarning(DiagnosticType type, TextSpan span) { Log(DiagnosticLevel::Warning, type, span); }
|
||
|
inline void LogError(DiagnosticType type, TextSpan span) { Log(DiagnosticLevel::Error, type, span); }
|
||
|
inline void LogCritical(DiagnosticType type, TextSpan span) { Log(DiagnosticLevel::Critical, type, span); }
|
||
|
|
||
|
[[nodiscard]] const std::vector<Diagnostic>& GetMessages() const noexcept { return _messages; }
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#endif // ELOHIMSCRIPT_DIAGNOSTICS_HPP
|