|
@ -1,25 +1,28 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.IO; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Text; |
|
|
using System.Text; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using IllusionPlugin.Logging; |
|
|
|
|
|
using LoggerBase = IllusionPlugin.Logging.Logger; |
|
|
|
|
|
|
|
|
namespace IllusionPlugin.Logging.Printers |
|
|
|
|
|
|
|
|
namespace IllusionInjector.Logging.Printers |
|
|
{ |
|
|
{ |
|
|
public class ColoredConsolePrinter : LogPrinter |
|
|
public class ColoredConsolePrinter : LogPrinter |
|
|
{ |
|
|
{ |
|
|
Logger.LogLevel filter = Logger.LogLevel.All; |
|
|
|
|
|
public override Logger.LogLevel Filter { get => filter; set => filter = value; } |
|
|
|
|
|
|
|
|
LoggerBase.LogLevel filter = LoggerBase.LogLevel.All; |
|
|
|
|
|
public override LoggerBase.LogLevel Filter { get => filter; set => filter = value; } |
|
|
|
|
|
|
|
|
ConsoleColor color = Console.ForegroundColor; |
|
|
ConsoleColor color = Console.ForegroundColor; |
|
|
public ConsoleColor Color { get => color; set => color = value; } |
|
|
public ConsoleColor Color { get => color; set => color = value; } |
|
|
|
|
|
|
|
|
public override void Print(Logger.Level level, DateTime time, string logName, string message) |
|
|
|
|
|
|
|
|
public override void Print(LoggerBase.Level level, DateTime time, string logName, string message) |
|
|
{ |
|
|
{ |
|
|
if (((byte)level & (byte)Filter) == 0) return; |
|
|
if (((byte)level & (byte)Filter) == 0) return; |
|
|
Console.ForegroundColor = color; |
|
|
Console.ForegroundColor = color; |
|
|
foreach (var line in message.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) |
|
|
foreach (var line in message.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) |
|
|
Console.WriteLine(string.Format(Logger.LogFormat, line, logName, time, level.ToString().ToUpper())); |
|
|
|
|
|
|
|
|
Console.WriteLine(string.Format(LoggerBase.LogFormat, line, logName, time, level.ToString().ToUpper())); |
|
|
Console.ResetColor(); |
|
|
Console.ResetColor(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|