#ifndef AL_DEBUG_H #define AL_DEBUG_H #include #include #include using uint = unsigned int; /* Somewhat arbitrary. Avoid letting it get out of control if the app enables * logging but never reads it. */ constexpr uint8_t MaxDebugLoggedMessages{64}; constexpr uint16_t MaxDebugMessageLength{1024}; constexpr uint8_t MaxDebugGroupDepth{64}; constexpr uint DebugSourceBase{0}; enum class DebugSource : uint8_t { API = 0, System, ThirdParty, Application, Other, }; constexpr uint DebugSourceCount{5}; constexpr uint DebugTypeBase{DebugSourceBase + DebugSourceCount}; enum class DebugType : uint8_t { Error = 0, DeprecatedBehavior, UndefinedBehavior, Portability, Performance, Marker, PushGroup, PopGroup, Other, }; constexpr uint DebugTypeCount{9}; constexpr uint DebugSeverityBase{DebugTypeBase + DebugTypeCount}; enum class DebugSeverity : uint8_t { High = 0, Medium, Low, Notification, }; constexpr uint DebugSeverityCount{4}; struct DebugGroup { const uint mId; const DebugSource mSource; std::string mMessage; std::vector mFilters; std::vector mIdFilters; template DebugGroup(DebugSource source, uint id, T&& message) : mId{id}, mSource{source}, mMessage{std::forward(message)} { } DebugGroup(const DebugGroup&) = default; DebugGroup(DebugGroup&&) = default; }; struct DebugLogEntry { const DebugSource mSource; const DebugType mType; const DebugSeverity mSeverity; const uint mId; std::string mMessage; template DebugLogEntry(DebugSource source, DebugType type, uint id, DebugSeverity severity, T&& message) : mSource{source}, mType{type}, mSeverity{severity}, mId{id} , mMessage{std::forward(message)} { } DebugLogEntry(const DebugLogEntry&) = default; DebugLogEntry(DebugLogEntry&&) = default; }; #endif /* AL_DEBUG_H */