diff --git a/CHANGELOG.md b/CHANGELOG.md index d0c7dcc..fe061a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -`1.0.1` +`1.0.2` - Removed Bloodstone Dependency - Added Optional CrimsonLog Support diff --git a/Plugin.cs b/Plugin.cs index 62aeada..16aa20d 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -3,7 +3,7 @@ using CrimsonChatFilter.Structs; using HarmonyLib; using BepInEx.Logging; -using Logger = CrimsonLog.Systems.Logger; +using System; namespace CrimsonChatFilter; @@ -42,14 +42,17 @@ public override void Load() public static void AddLog(string message, bool console = false) { - if (LogLoaded && CrimsonLog.Plugin.LogInstance != null && !console) + if (LogLoaded && !console) { - Logger.Record("Chat/Filter", "filter", message); - } - else - { - LogInstance.LogInfo(message); + var loggerType = Type.GetType("CrimsonLog.Systems.Logger, CrimsonLog"); + if (loggerType != null) + { + loggerType.GetMethod("Record").Invoke(null, new object[] { "Chat/Filter", "filter", message }); + return; + } } + + LogInstance.LogInfo(message); } public override bool Unload()