From b4a6546940711b3cc848218c45bbe4e24a32f2e4 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Mon, 30 Jul 2018 20:07:07 -0500 Subject: [PATCH] Redid logger to be both more modular and more similar to Syslog --- IPA/IPA.csproj | 8 +- .../Debug/IPA.csproj.CoreCompileInputs.cache | 2 +- IPA/packages.config | 2 +- .../BeatSaber/CompositeBSPlugin.cs | 12 +- IllusionInjector/IPA/CompositeIPAPlugin.cs | 6 +- IllusionInjector/IllusionInjector.csproj | 10 + .../Logging/Printers/ColoredConsolePrinter.cs | 26 +++ .../Logging/Printers/GlobalZFIlePrinter.cs | 55 +++++ .../Logging/Printers/PluginLogFilePrinter.cs | 48 +++++ IllusionInjector/Logging/StandardLogger.cs | 134 ++++++++++++ IllusionInjector/PluginManager.cs | 23 +-- ...ionInjector.csproj.CoreCompileInputs.cache | 2 +- IllusionInjector/packages.config | 4 + .../{IPA => }/IGenericEnhancedPlugin.cs | 0 IllusionPlugin/IllusionPlugin.csproj | 5 +- IllusionPlugin/Logger.cs | 190 ------------------ IllusionPlugin/Logging/LogPrinter.cs | 16 ++ IllusionPlugin/Logging/Logger.cs | 52 +++++ ...usionPlugin.csproj.CoreCompileInputs.cache | 2 +- 19 files changed, 374 insertions(+), 223 deletions(-) create mode 100644 IllusionInjector/Logging/Printers/ColoredConsolePrinter.cs create mode 100644 IllusionInjector/Logging/Printers/GlobalZFIlePrinter.cs create mode 100644 IllusionInjector/Logging/Printers/PluginLogFilePrinter.cs create mode 100644 IllusionInjector/Logging/StandardLogger.cs create mode 100644 IllusionInjector/packages.config rename IllusionPlugin/{IPA => }/IGenericEnhancedPlugin.cs (100%) delete mode 100644 IllusionPlugin/Logger.cs create mode 100644 IllusionPlugin/Logging/LogPrinter.cs create mode 100644 IllusionPlugin/Logging/Logger.cs diff --git a/IPA/IPA.csproj b/IPA/IPA.csproj index e3ce2d01..cf4e8634 100644 --- a/IPA/IPA.csproj +++ b/IPA/IPA.csproj @@ -40,19 +40,19 @@ - ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.dll + ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll True - ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.Mdb.dll + ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll False - ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.Pdb.dll + ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll False - ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.Rocks.dll + ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll False diff --git a/IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache b/IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache index bb31db24..d5116832 100644 --- a/IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache +++ b/IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -6744afebdfdc05ced46858bdac21e047b0d6e43f +33cd6c2ad2a5a7958d22e4f89028cf896273055b diff --git a/IPA/packages.config b/IPA/packages.config index 74fdd86f..f30e7947 100644 --- a/IPA/packages.config +++ b/IPA/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/IllusionInjector/BeatSaber/CompositeBSPlugin.cs b/IllusionInjector/BeatSaber/CompositeBSPlugin.cs index b2cb45a4..37dba73b 100644 --- a/IllusionInjector/BeatSaber/CompositeBSPlugin.cs +++ b/IllusionInjector/BeatSaber/CompositeBSPlugin.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using UnityEngine; using UnityEngine.SceneManagement; -using Logger = IllusionPlugin.Logger; +using Logger = IllusionInjector.Logging.Logger; namespace IllusionInjector { public class CompositeBSPlugin : IBeatSaberPlugin @@ -13,8 +13,6 @@ namespace IllusionInjector { IEnumerable plugins; private delegate void CompositeCall(IBeatSaberPlugin plugin); - - private Logger debugLogger => PluginManager.debugLogger; public CompositeBSPlugin(IEnumerable plugins) { this.plugins = plugins; @@ -34,7 +32,7 @@ namespace IllusionInjector { plugin.OnSceneLoaded(scene, sceneMode); } catch (Exception ex) { - debugLogger.Exception($"{plugin.Name}: {ex}"); + Logger.log.Error($"{plugin.Name}: {ex}"); } } } @@ -45,7 +43,7 @@ namespace IllusionInjector { plugin.OnSceneUnloaded(scene); } catch (Exception ex) { - debugLogger.Exception($"{plugin.Name}: {ex}"); + Logger.log.Error($"{plugin.Name}: {ex}"); } } } @@ -56,7 +54,7 @@ namespace IllusionInjector { plugin.OnActiveSceneChanged(prevScene, nextScene); } catch (Exception ex) { - debugLogger.Exception($"{plugin.Name}: {ex}"); + Logger.log.Error($"{plugin.Name}: {ex}"); } } } @@ -67,7 +65,7 @@ namespace IllusionInjector { callback(plugin); } catch (Exception ex) { - debugLogger.Exception($"{plugin.Name}: {ex}"); + Logger.log.Error($"{plugin.Name}: {ex}"); } } } diff --git a/IllusionInjector/IPA/CompositeIPAPlugin.cs b/IllusionInjector/IPA/CompositeIPAPlugin.cs index 5b64bfaa..001677a6 100644 --- a/IllusionInjector/IPA/CompositeIPAPlugin.cs +++ b/IllusionInjector/IPA/CompositeIPAPlugin.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using UnityEngine; using UnityEngine.SceneManagement; -using Logger = IllusionPlugin.Logger; +using Logger = IllusionInjector.Logging.Logger; namespace IllusionInjector { #pragma warning disable CS0618 // Type or member is obsolete @@ -14,8 +14,6 @@ namespace IllusionInjector { IEnumerable plugins; private delegate void CompositeCall(IPlugin plugin); - - private Logger debugLogger => PluginManager.debugLogger; public CompositeIPAPlugin(IEnumerable plugins) { this.plugins = plugins; @@ -35,7 +33,7 @@ namespace IllusionInjector { callback(plugin); } catch (Exception ex) { - debugLogger.Exception($"{plugin.Name}: {ex}"); + Logger.log.Error($"{plugin.Name}: {ex}"); } } } diff --git a/IllusionInjector/IllusionInjector.csproj b/IllusionInjector/IllusionInjector.csproj index 7008659c..a8a56c31 100644 --- a/IllusionInjector/IllusionInjector.csproj +++ b/IllusionInjector/IllusionInjector.csproj @@ -45,6 +45,9 @@ ..\Libs\UnityEngine.CoreModule.dll False + + ..\packages\zlib.net.1.0.4.0\lib\zlib.net.dll + @@ -52,6 +55,10 @@ + + + + @@ -62,6 +69,9 @@ IllusionPlugin + + +