11 private static readonly Dictionary<string, ulong>
s_Masks =
new Dictionary<string, ulong>
59 ulong value = (ulong)1 <<
s_Masks.Count - 1;
105 for (ulong power = 1; power > 0; power <<= 1)
134 return masks.Aggregate<
BadLogMask, ulong>(0, (current, name) => current | name.
m_Mask);
179 return Array.Empty<
string>();
182 List<string> names = (from kvp in
s_Masks where kvp.Value != 0 && (kvp.Value &
m_Mask) == kvp.Value select kvp.Key).ToList();
184 return names.Count == 0 ? Array.Empty<
string>() : names.ToArray();
194 return string.Join(
" ", mask.
GetNames());
Implements a Mask for Log Messages.
static readonly BadLogMask None
Static Helper for the "None" Mask.
static BadLogMask GetMask(params BadLogMask[] masks)
Returns a combined mask of all masks provided.
static readonly Dictionary< string, ulong > s_Masks
The Masks that are "known".
override string ToString()
Returns string representation of the mask.
static readonly BadLogMask Default
Static Helper for the "Default" Mask.
string[] GetNames()
Returns a list of masks that are contained in this mask.
BadLogMask(ulong mask)
Creates a new Log Mask.
bool Contains(BadLogMask mask)
Returns true if the other mask is contained in this mask.
bool IsExactly(BadLogMask other)
Returns true if this mask is identical to the other mask.
static BadLogMask Register(string name)
Registers a new Mask Name.
static bool IsPowerOfTwo(ulong number)
Returns true if the specified number is a power of two.
readonly ulong m_Mask
The Mask Flags.
bool IsContainedIn(BadLogMask other)
Returns true if this mask is contained in the other mask.
static readonly BadLogMask All
Static Helper for the "All" Mask.
Contains Logging system for the BadScript Runtime.