Game.Debug.LogsDebugUI
Assembly: Game (Assembly-CSharp)
Namespace: Game.Debug
Type: static class
Base: System.Object
Summary: Provides an in-game debug UI tab ("Logs") to view and modify logging settings for all registered loggers. The class is a debug container (annotated with [DebugContainer]) and exposes a debug tab (annotated with [DebugTab("Logs", 0)]) that builds a list of widgets allowing developers to change each logger's effectiveness level, whether errors are shown in the UI, stack-trace logging, backtrace disabling (if QA developer mode is enabled), and the stack-trace display level. It also includes a Refresh button that rebuilds the UI.
Fields
- This class does not declare any fields. {{ The LogsDebugUI class is purely static and does not store state in fields. All UI is constructed on demand in BuildLogsDebugUI(). }}
Properties
- This class does not declare any properties. {{ The debug UI is generated dynamically; no persistent properties are defined on the class. }}
Constructors
- This static class has no constructors. {{ Being a static utility-style debug container, it relies on attributes and static methods and doesn't require construction. }}
Methods
-
private static void Rebuild() : System.Void
{{ Rebuilds the debug UI by calling DebugSystem.Rebuild with the BuildLogsDebugUI method. This is used as the action for the "Refresh" button so the UI can be regenerated at runtime. }} -
private static List<DebugUI.Widget> BuildLogsDebugUI() : System.Collections.Generic.List<DebugUI.Widget>
{{ Builds and returns the list of DebugUI widgets that make up the "Logs" debug tab. Implementation details: - Creates a root DebugUI.Container.
- Retrieves the available log levels via Level.GetLevels().
- Iterates through LogManager.GetAllLoggers() and for each ILog:
- Adds a DebugUI.EnumField to adjust the logger's effectivenessLevel (uses level names and severity values).
- Creates a sub-container with:
- DebugUI.BoolField: "Show errors in UI" -> toggles ILog.showsErrorsInUI.
- DebugUI.BoolField: "Log stack trace" -> toggles ILog.logStackTrace.
- If GameManager.instance.configuration.qaDeveloperMode is true, adds "Disable backtrace" -> toggles ILog.disableBacktrace.
- DebugUI.EnumField: "Show stack trace below levels" -> controls ILog.showsStackTraceAboveLevels.
- Adds a top-level "Refresh" DebugUI.Button which calls Rebuild() when pressed.
- Returns the assembled widgets for rendering in the debug tab.
-
Contains a small local helper ToTitleCase(string) -> GUIContent to format level names for display. }}
-
(local function)
static GUIContent ToTitleCase(string input)
{{ Helper local function inside BuildLogsDebugUI that converts a level name to title case (capitalizes first letter and lowercases the rest) and returns a UnityEngine.GUIContent. This is used to produce user-friendly enum display names. }}
Additional notes: - The class is annotated with [DebugContainer], and BuildLogsDebugUI is annotated with [DebugTab("Logs", 0)], so the debug system will surface the generated widgets under a "Logs" tab. - The UI interacts with Colossal.Logging types (ILog, LogManager, Level) and DebugUI widget types. It also references GameManager.instance.configuration.qaDeveloperMode to conditionally show QA-only options.
Usage Example
// This class is discovered by the game's debug system via the [DebugContainer] attribute.
// When the debug UI is opened, the BuildLogsDebugUI method (annotated with [DebugTab("Logs", 0)])
// will be used to populate the "Logs" tab. Pressing the "Refresh" button will call Rebuild()
// which calls DebugSystem.Rebuild(BuildLogsDebugUI) to regenerate the UI.
[DebugContainer]
public static class LogsDebugUI
{
// (Implementation from the provided file)
}
// If you need to programmatically force the debug UI to rebuild:
LogsDebugUI.Rebuild(); // internal/private in original source; if exposed, this triggers a rebuild.
{{ Tips: - This debug UI is intended for runtime tweaking during development and QA. Use caution when changing logger settings in a live session. - Because the UI is recreated on rebuild, any transient selections or edits that are not persisted to the logger will be lost on refresh. - The QA-only "Disable backtrace" option is only shown when GameManager.instance.configuration.qaDeveloperMode is enabled. }}