Skip to content

Commit

Permalink
Fix #295: enhance cLog::DebugFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
terrillmoore committed May 4, 2021
1 parent 42e3f40 commit 9553e12
Showing 1 changed file with 47 additions and 8 deletions.
55 changes: 47 additions & 8 deletions src/Catena_Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,42 @@ class cLog
public:
enum DebugFlags : uint32_t
{
kAlways = 0u,
kFatal = 0xFFFFFFFFu,

kBug = 0x00000001u,
kError = 0x00000002u,
kWarning = 0x00000004u,
kTrace = 0x00000008u,
kInfo = 0x00000010u,
kAlways = 0u, ///< this mask is always enabled
kFatal = 0xFFFFFFFFu, ///< this mask indicates a fatal error, always enabled

kBug = 0x00000001u, ///< use this for errors that indicate software bugs
kError = 0x00000002u, ///< use this for errors that indicate operational probs
kWarning = 0x00000004u, ///< use this for warnings; not an error but might need attention
kInfo = 0x00000008u, ///< use this for normal informational messages.
kVerbose = 0x00000010u, ///< use this for verbose (chatty) messages
kRfu5 = 0x00000020u, ///< reserved for future definition in library
kRfu6 = 0x00000040u, ///< reserved for future definition in library
kRfu7 = 0x00000080u, ///< reserved for future definition in library
kUser8 = 0x00000100u, ///< Reserved for use by programs and applications
kUser9 = 0x00000200u, ///< Reserved for use by programs and applications
kUser10 = 0x00000400u, ///< Reserved for use by programs and applications
kUser11 = 0x00000800u, ///< Reserved for use by programs and applications
kUser12 = 0x00001000u, ///< Reserved for use by programs and applications
kUser13 = 0x00002000u, ///< Reserved for use by programs and applications
kUser14 = 0x00004000u, ///< Reserved for use by programs and applications
kUser15 = 0x00008000u, ///< Reserved for use by programs and applications
kTrace0 = 0x00010000u, ///< "Trace": debugging bit 0
kTrace = kTrace0, ///< Legacy name for kTrace0
kTrace1 = 0x00020000u, ///< Library debugging trace bit 1
kTrace2 = 0x00040000u, ///< Library debugging trace bit 2
kTrace3 = 0x00080000u, ///< Library debugging trace bit 3
kTrace4 = 0x00100000u, ///< Library debugging trace bit 4
kTrace5 = 0x00200000u, ///< Library debugging trace bit 5
kTrace6 = 0x00400000u, ///< Library debugging trace bit 6
kTrace7 = 0x00800000u, ///< Library debugging trace bit 7
kUserTrace8 = 0x01000000u, ///< User debugging trace bit 8
kUserTrace9 = 0x02000000u, ///< User debugging trace bit 9
kUserTrace10 = 0x04000000u, ///< User debugging trace bit 10
kUserTrace11 = 0x08000000u, ///< User debugging trace bit 11
kUserTrace12 = 0x10000000u, ///< User debugging trace bit 12
kUserTrace13 = 0x20000000u, ///< User debugging trace bit 13
kUserTrace14 = 0x40000000u, ///< User debugging trace bit 14
kUserTrace15 = 0x80000000u, ///< User debugging trace bit 15
};

cLog(DebugFlags flags = DebugFlags(0))
Expand Down Expand Up @@ -113,6 +141,17 @@ class cLog
DebugFlags m_uDebugFlags;
};

inline cLog::DebugFlags operator| (cLog::DebugFlags a, cLog::DebugFlags b)
{
return cLog::DebugFlags(std::uint32_t(a) | std::uint32_t(b));
}

inline cLog::DebugFlags& operator| (cLog::DebugFlags& a, cLog::DebugFlags b)
{
a = cLog::DebugFlags(std::uint32_t(a) | std::uint32_t(b));
return a;
}

extern cLog gLog;

}; // namespace McciCatena
Expand Down

0 comments on commit 9553e12

Please sign in to comment.