Class ConsoleFormatterHelpers
- Namespace
- FishMMO.Logging
- Assembly
- FishMMO-Logger.dll
Provides shared helper methods and constants for console formatting, used by both ConsoleFormatter and UnityConsoleFormatter to ensure consistent output.
public static class ConsoleFormatterHelpers
- Inheritance
-
ConsoleFormatterHelpers
- Inherited Members
Fields
ConsoleColorRgbMap
public static readonly Dictionary<ConsoleColor, (byte r, byte g, byte b)> ConsoleColorRgbMap
Field Value
- Dictionary<ConsoleColor, (byte r, byte g, byte b)>
LogLevelColumnWidth
public const int LogLevelColumnWidth = 12
Field Value
SourceColumnWidth
public const int SourceColumnWidth = 18
Field Value
TimestampColumnWidth
public const int TimestampColumnWidth = 12
Field Value
Methods
EscapeUnityRichText(string)
Escapes characters in a string that might be interpreted as Unity rich text tags. This prevents malformed tags from breaking the console output. This method is specific to Unity's rich text, but is placed here for shared access.
public static string EscapeUnityRichText(string text)
Parameters
textstringThe text to escape.
Returns
- string
The escaped text.
FindClosestConsoleColor((byte r, byte g, byte b))
Finds the closest System.ConsoleColor to a given RGB tuple using Euclidean distance.
public static ConsoleColor FindClosestConsoleColor((byte r, byte g, byte b) targetRgb)
Parameters
Returns
GetClosestConsoleColor(string)
Converts a hex color string or named color to the closest System.ConsoleColor.
public static ConsoleColor GetClosestConsoleColor(string color)
Parameters
colorstring
Returns
GetSourceColor(string, LogLevel)
Gets a specific color for the log source (e.g., Daemon, Orchestration, App Name) or applies a default color based on the LogLevel if no specific source matches.
public static ConsoleColor GetSourceColor(string source, LogLevel level)
Parameters
Returns
PadRight(string, int)
Pads a string to a specified total width.
public static string PadRight(string text, int totalWidth)
Parameters
Returns
- string
The padded string.