aboutsummaryrefslogtreecommitdiffstats
path: root/al/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'al/debug.h')
-rw-r--r--al/debug.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/al/debug.h b/al/debug.h
index 23b0ca1b..c2147cf4 100644
--- a/al/debug.h
+++ b/al/debug.h
@@ -2,6 +2,10 @@
#define AL_DEBUG_H
#include <stdint.h>
+#include <string>
+#include <vector>
+
+using uint = unsigned int;
/* Somewhat arbitrary. Avoid letting it get out of control if the app enables
@@ -10,4 +14,69 @@
constexpr uint8_t MaxDebugLoggedMessages{64};
constexpr uint16_t MaxDebugMessageLength{1024};
+
+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,
+ Other,
+};
+constexpr uint DebugTypeCount{7};
+
+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<uint> mFilters;
+ std::vector<uint64_t> mIdFilters;
+
+ template<typename T>
+ DebugGroup(DebugSource source, uint id, T&& message)
+ : mId{id}, mSource{source}, mMessage{std::forward<T>(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<typename T>
+ DebugLogEntry(DebugSource source, DebugType type, uint id, DebugSeverity severity, T&& message)
+ : mSource{source}, mType{type}, mSeverity{severity}, mId{id}
+ , mMessage{std::forward<T>(message)}
+ { }
+ DebugLogEntry(const DebugLogEntry&) = default;
+ DebugLogEntry(DebugLogEntry&&) = default;
+};
+
#endif /* AL_DEBUG_H */