11 enum class Severity : uint8_t {
37 virtual void Log(std::string_view msg, Severity severity) = 0;
43 namespace SeverityUtils {
49 [[maybe_unused]] constexpr std::string_view
ToString(Severity severity) noexcept {
51 case Severity::Fatal:
return "Fatal";
52 case Severity::Error:
return "Error";
53 case Severity::Warning:
return "Warning";
54 case Severity::Info:
return "Info";
55 case Severity::Debug:
return "Debug";
56 case Severity::Verbose:
return "Verbose";
57 default:
return "None";
66 [[maybe_unused]] constexpr Severity
FromString(std::string_view severity) noexcept {
67 if (severity ==
"Fatal") {
68 return Severity::Fatal;
69 }
else if (severity ==
"Error") {
70 return Severity::Error;
71 }
else if (severity ==
"Warning") {
72 return Severity::Warning;
73 }
else if (severity ==
"Info") {
74 return Severity::Info;
75 }
else if (severity ==
"Debug") {
76 return Severity::Debug;
77 }
else if (severity ==
"Verbose") {
78 return Severity::Verbose;
80 return Severity::None;
Interface for logging messages with different severity levels.
virtual void Log(std::string_view msg, Severity severity)=0
Log a message with the specified severity level.
constexpr std::string_view ToString(Severity severity) noexcept
Convert a Severity enum value to its string representation.
constexpr Severity FromString(std::string_view severity) noexcept
Convert a string representation to a Severity enum value.