using System; using Swan.Lite.Logging; namespace Swan.Logging { /// /// Represents a Console implementation of ILogger. /// /// // [Obsolete("NEED", false)] public class ConsoleLogger : TextLogger, ILogger { /// /// Initializes a new instance of the class. /// protected ConsoleLogger() { // Empty } /// /// Gets the current instance of ConsoleLogger. /// /// /// The instance. /// public static ConsoleLogger Instance { get; } = new ConsoleLogger(); /// /// Gets or sets the debug logging prefix. /// /// /// The debug prefix. /// public static String DebugPrefix { get; set; } = "DBG"; /// /// Gets or sets the trace logging prefix. /// /// /// The trace prefix. /// public static String TracePrefix { get; set; } = "TRC"; /// /// Gets or sets the warning logging prefix. /// /// /// The warn prefix. /// public static String WarnPrefix { get; set; } = "WRN"; /// /// Gets or sets the fatal logging prefix. /// /// /// The fatal prefix. /// public static String FatalPrefix { get; set; } = "FAT"; /// /// Gets or sets the error logging prefix. /// /// /// The error prefix. /// public static String ErrorPrefix { get; set; } = "ERR"; /// /// Gets or sets the information logging prefix. /// /// /// The information prefix. /// public static String InfoPrefix { get; set; } = "INF"; /// /// Gets or sets the color of the information output logging. /// /// /// The color of the information. /// public static ConsoleColor InfoColor { get; set; } = ConsoleColor.Cyan; /// /// Gets or sets the color of the debug output logging. /// /// /// The color of the debug. /// public static ConsoleColor DebugColor { get; set; } = ConsoleColor.Gray; /// /// Gets or sets the color of the trace output logging. /// /// /// The color of the trace. /// public static ConsoleColor TraceColor { get; set; } = ConsoleColor.DarkGray; /// /// Gets or sets the color of the warning logging. /// /// /// The color of the warn. /// public static ConsoleColor WarnColor { get; set; } = ConsoleColor.Yellow; /// /// Gets or sets the color of the error logging. /// /// /// The color of the error. /// public static ConsoleColor ErrorColor { get; set; } = ConsoleColor.DarkRed; /// /// Gets or sets the color of the error logging. /// /// /// The color of the error. /// public static ConsoleColor FatalColor { get; set; } = ConsoleColor.Red; /// public LogLevel LogLevel { get; set; } = DebugLogger.IsDebuggerAttached ? LogLevel.Trace : LogLevel.Info; /// // [Obsolete("NEED", false)] public void Log(LogMessageReceivedEventArgs logEvent) { // Select the writer based on the message type TerminalWriters writer = logEvent.MessageType == LogLevel.Error ? TerminalWriters.StandardError : TerminalWriters.StandardOutput; (String outputMessage, ConsoleColor color) = this.GetOutputAndColor(logEvent); Terminal.Write(outputMessage, color, writer); } /// public void Dispose() { // Do nothing } } }