public void DumpStats() { if ((mStats != null) && (DebuggingLevel >= Common.DebugLevel.Quiet)) { mStats.Dump(DebuggingLevel.ToString(), GetValue <ManagerStory.MaxDumpLengthOption, int>()); } }
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(); } } }
internal static void Indent(DebuggingLevel p_min_level = DebuggingLevel.Basic) { if (debugging_level < p_min_level) { return; } indentation_level++; Indentation += INDENTATION_CHAR; }
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; }
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; } }
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); }