Include fmt 11.0.2
[openal-soft.git] / al / debug.h
blobd1792adb41e6b66bdfb13f72611a9bfe7862a09a
1 #ifndef AL_DEBUG_H
2 #define AL_DEBUG_H
4 #include <cstdint>
5 #include <string>
6 #include <utility>
7 #include <vector>
9 using uint = unsigned int;
12 /* Somewhat arbitrary. Avoid letting it get out of control if the app enables
13 * logging but never reads it.
15 inline constexpr std::uint8_t MaxDebugLoggedMessages{64};
16 inline constexpr std::uint16_t MaxDebugMessageLength{1024};
17 inline constexpr std::uint8_t MaxDebugGroupDepth{64};
18 inline constexpr std::uint16_t MaxObjectLabelLength{1024};
21 inline constexpr uint DebugSourceBase{0};
22 enum class DebugSource : std::uint8_t {
23 API = 0,
24 System,
25 ThirdParty,
26 Application,
27 Other,
29 inline constexpr uint DebugSourceCount{5};
31 inline constexpr uint DebugTypeBase{DebugSourceBase + DebugSourceCount};
32 enum class DebugType : std::uint8_t {
33 Error = 0,
34 DeprecatedBehavior,
35 UndefinedBehavior,
36 Portability,
37 Performance,
38 Marker,
39 PushGroup,
40 PopGroup,
41 Other,
43 inline constexpr uint DebugTypeCount{9};
45 inline constexpr uint DebugSeverityBase{DebugTypeBase + DebugTypeCount};
46 enum class DebugSeverity : std::uint8_t {
47 High = 0,
48 Medium,
49 Low,
50 Notification,
52 inline constexpr uint DebugSeverityCount{4};
54 struct DebugGroup {
55 const uint mId;
56 const DebugSource mSource;
57 std::string mMessage;
58 std::vector<uint> mFilters;
59 std::vector<std::uint64_t> mIdFilters;
61 template<typename T>
62 DebugGroup(DebugSource source, uint id, T&& message)
63 : mId{id}, mSource{source}, mMessage{std::forward<T>(message)}
64 { }
65 DebugGroup(const DebugGroup&) = default;
66 DebugGroup(DebugGroup&&) = default;
67 ~DebugGroup();
70 #endif /* AL_DEBUG_H */