namespace GitConverter.Lib.Logging { /// /// Provides reusable logging formatting utilities for structured log output. /// /// /// - These helpers add visual structure to log files (separators, underlines, boxes). /// - All methods are static for convenience and accept an instance. /// - Useful for creating consistent, readable sections in diagnostic logs. /// public static class LogHelper { /// /// Log a message with an underline using the specified character. /// /// The logger instance to use. /// The message to log. /// Character to use for underline (default: '='). /// /// Creates an underline that matches the message length. Useful for section headers. /// public static void LogWithUnderline(IAppLogger logger, string message, char underlineChar = '=') { if (logger == null || string.IsNullOrEmpty(message)) return; logger.Info(message); logger.Info(new string(underlineChar, message.Length)); } /// /// Log a message followed by a separator line of fixed length. /// /// The logger instance to use. /// The message to log. /// Character to use for separator (default: '-'). /// Length of the separator line (default: 80). /// /// Useful for creating visual sections in log files with consistent formatting. /// public static void LogWithSeparator(IAppLogger logger, string message, char separatorChar = '-', int separatorLength = 80) { if (logger == null || string.IsNullOrEmpty(message)) return; logger.Info(message); logger.Info(new string(separatorChar, separatorLength)); } /// /// Log a message within a box/frame. /// /// The logger instance to use. /// The message to log. /// Character to use for border (default: '='). /// /// Creates a bordered box around the message for emphasis in logs. /// public static void LogWithBox(IAppLogger logger, string message, char borderChar = '=') { if (logger == null || string.IsNullOrEmpty(message)) return; var border = new string(borderChar, message.Length + 4); logger.Info(border); logger.Info($"| {message} |"); logger.Info(border); } /// /// Log a blank line for spacing. /// /// The logger instance to use. public static void LogBlankLine(IAppLogger logger) { if (logger == null) return; logger.Info(string.Empty); } } }