Browse Source

Tweaked some logger stuff

pull/46/head
Anairkoen Schno 6 years ago
parent
commit
bb31fb18ef
3 changed files with 10 additions and 8 deletions
  1. +8
    -5
      IllusionInjector/Logging/Printers/ColoredConsolePrinter.cs
  2. +1
    -1
      IllusionInjector/Logging/Printers/PluginLogFilePrinter.cs
  3. +1
    -2
      IllusionInjector/Logging/StandardLogger.cs

+ 8
- 5
IllusionInjector/Logging/Printers/ColoredConsolePrinter.cs View File

@ -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();
} }
} }


+ 1
- 1
IllusionInjector/Logging/Printers/PluginLogFilePrinter.cs View File

@ -9,7 +9,7 @@ using LoggerBase = IllusionPlugin.Logging.Logger;
namespace IllusionInjector.Logging.Printers namespace IllusionInjector.Logging.Printers
{ {
public class PluginLogFilePrinter : GZFilePrinter
class PluginLogFilePrinter : GZFilePrinter
{ {
public override LoggerBase.LogLevel Filter { get; set; } = LoggerBase.LogLevel.All; public override LoggerBase.LogLevel Filter { get; set; } = LoggerBase.LogLevel.All;


+ 1
- 2
IllusionInjector/Logging/StandardLogger.cs View File

@ -1,6 +1,5 @@
using IllusionInjector.Logging.Printers; using IllusionInjector.Logging.Printers;
using IllusionPlugin.Logging; using IllusionPlugin.Logging;
using IllusionPlugin.Logging.Printers;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
@ -20,7 +19,7 @@ namespace IllusionInjector.Logging
get get
{ {
if (_log == null) if (_log == null)
_log = new StandardLogger("IllusionInjector");
_log = new StandardLogger("IPA");
return _log; return _log;
} }
} }


Loading…
Cancel
Save