示例#1
0
 public void DumpStats()
 {
     if ((mStats != null) && (DebuggingLevel >= Common.DebugLevel.Quiet))
     {
         mStats.Dump(DebuggingLevel.ToString(), GetValue <ManagerStory.MaxDumpLengthOption, int>());
     }
 }
示例#2
0
        private static void Log(string p_message, DebugChannel p_channel, DebuggingLevel p_min_level, Indentation p_pre, Indentation p_post)
        {
            if (!enable_debugging && p_channel == DebugChannel.Debug)
            {
                return;
            }
            if (debugging_level < p_min_level)
            {
                return;
            }

            // If the pre-indentation style is not set to none, perform the necessary indentation/unindentation/reset task first
            if (p_pre > 0)
            {
                if (p_pre == Debugging.Indentation.Indent)
                {
                    Indent();
                }
                else if (p_pre == Debugging.Indentation.Unindent)
                {
                    Unindent();
                }
                else if (p_pre == Debugging.Indentation.Reset)
                {
                    ResetIndentation();
                }
            }

            // Re-format the message to include the channel tag, timestamp and indentation
            string message = $"{p_channel.Tag()} {Timestamp} > {Indentation}{p_message}";

            // Print the message to the console using the correct colours
            if (p_channel != DebugChannel.Debug)
            {
                Console.WriteLine(message, p_channel.Colour());
            }
            else
            {
                // If using the [debug] channel, use the debug stylesheet to allow syntax highlighting
                Console.WriteLineStyled(message, debug_style_sheet);
            }

            // If the post-indentation style is not set to none, perform the necessary indentation/unindentation/reset task
            if (p_post > 0)
            {
                if (p_post == Debugging.Indentation.Indent)
                {
                    Indent();
                }
                else if (p_post == Debugging.Indentation.Unindent)
                {
                    Unindent();
                }
                else if (p_post == Debugging.Indentation.Reset)
                {
                    ResetIndentation();
                }
            }
        }
示例#3
0
        internal static void Indent(DebuggingLevel p_min_level = DebuggingLevel.Basic)
        {
            if (debugging_level < p_min_level)
            {
                return;
            }

            indentation_level++;
            Indentation += INDENTATION_CHAR;
        }
示例#4
0
        internal static void ResetIndentation(DebuggingLevel p_min_level = DebuggingLevel.Basic)
        {
            if (debugging_level < p_min_level)
            {
                return;
            }
            if (indentation_level == 0)
            {
                return;
            }

            indentation_level = 0;
            Indentation       = string.Empty;
        }
示例#5
0
        internal static void Unindent(DebuggingLevel p_min_level = DebuggingLevel.Basic)
        {
            if (debugging_level < p_min_level)
            {
                return;
            }

            if (--indentation_level < 0)
            {
                indentation_level = 0;
            }

            Indentation = string.Empty;

            for (int i = 0; i < indentation_level; ++i)
            {
                Indentation += INDENTATION_CHAR;
            }
        }
示例#6
0
 internal static void LogCritical(string p_message, DebuggingLevel p_min_level = DebuggingLevel.Basic, Indentation p_pre = Debugging.Indentation.None, Indentation p_post = Debugging.Indentation.None)
 {
     Log(p_message, DebugChannel.Critical, p_min_level, p_pre, p_post);
 }