11 private static readonly Dictionary<string, ulong>
s_Masks =
new Dictionary<string, ulong>
13 {
"None", 0 }, {
"Default", 1 },
54 ulong value = (ulong)1 << (
s_Masks.Count - 1);
100 for (ulong power = 1; power > 0; power <<= 1)
129 return masks.Aggregate<
BadLogMask, ulong>(0, (current, name) => current | name.
m_Mask);
150 return new[] {
"None" };
155 return new[] {
"All" };
169 return Array.Empty<
string>();
173 (from kvp in
s_Masks where kvp.Value != 0 && (kvp.Value &
m_Mask) == kvp.Value select kvp.Key).ToList();
175 return names.Count == 0 ? Array.Empty<
string>() : names.ToArray();
185 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.