diff --git a/HellionChat/AutoTellTabsService.cs b/HellionChat/AutoTellTabsService.cs index a3952b9..977b77c 100644 --- a/HellionChat/AutoTellTabsService.cs +++ b/HellionChat/AutoTellTabsService.cs @@ -96,7 +96,7 @@ internal sealed class AutoTellTabsService : IDisposable if (partner == null) { // Diagnostics: helps detect regressions (FFXIV payload changes, new edge cases) - Plugin.Log.Warning( + Plugin.LogProxy.Warning( $"[AutoTellTabs] Could not extract tell partner. type={message.Code.Type}, " + $"senderChunks={message.Sender.Count}, contentChunks={message.Content.Count}, " + $"senderSourcePayloads={message.SenderSource?.Payloads?.Count ?? 0}, " @@ -300,7 +300,7 @@ internal sealed class AutoTellTabsService : IDisposable catch (Exception ex) { // Non-fatal: tab still spawns with visible error notice instead of silent history loss - Plugin.Log.Error(ex, "[AutoTellTabs] History preload failed"); + Plugin.LogProxy.Error(ex, "[AutoTellTabs] History preload failed"); tab.Messages.AddPrune( MakeSystemMarker(HellionStrings.AutoTellTabs_HistoryLoadError), MessageManager.MessageDisplayLimit diff --git a/HellionChat/Commands.cs b/HellionChat/Commands.cs index 7d618d5..dfe79c0 100755 --- a/HellionChat/Commands.cs +++ b/HellionChat/Commands.cs @@ -52,7 +52,7 @@ internal sealed class Commands : IDisposable { if (!Registered.TryGetValue(command, out var wrapper)) { - Plugin.Log.Warning($"Missing registration for command {command}"); + Plugin.LogProxy.Warning($"Missing registration for command {command}"); return; } @@ -62,7 +62,7 @@ internal sealed class Commands : IDisposable } catch (Exception ex) { - Plugin.Log.Error(ex, $"Error while executing command {command}"); + Plugin.LogProxy.Error(ex, $"Error while executing command {command}"); } } } diff --git a/HellionChat/Configuration.cs b/HellionChat/Configuration.cs index fee30ca..47de533 100755 --- a/HellionChat/Configuration.cs +++ b/HellionChat/Configuration.cs @@ -83,7 +83,7 @@ public class Configuration : IPluginConfiguration // silently, like before. if (!Enum.IsDefined(typeof(ChatType), type) && _warnedUnknownChannels.Add(type)) { - Plugin.Log.Warning( + Plugin.LogProxy.Warning( "PrivacyFilter: unrecognised ChatType {Type} — falling back to PrivacyPersistUnknownChannels={Persist}.", type, PrivacyPersistUnknownChannels diff --git a/HellionChat/EmoteCache.cs b/HellionChat/EmoteCache.cs index 320006f..0af31b7 100644 --- a/HellionChat/EmoteCache.cs +++ b/HellionChat/EmoteCache.cs @@ -101,7 +101,10 @@ public static class EmoteCache t => { if (t.IsFaulted) - Plugin.Log.Error(t.Exception!, $"EmoteCache load failed for {emoteCode}"); + Plugin.LogProxy.Error( + t.Exception!, + $"EmoteCache load failed for {emoteCode}" + ); }, TaskScheduler.Default ) @@ -158,7 +161,7 @@ public static class EmoteCache { // Reset to Unloaded so a later trigger can retry without a plugin reload. State = LoadingState.Unloaded; - Plugin.Log.Error(ex, "BetterTTV cache wasn't initialized"); + Plugin.LogProxy.Error(ex, "BetterTTV cache wasn't initialized"); } } @@ -214,7 +217,7 @@ public static class EmoteCache } catch { - Plugin.Log.Error("Failed to convert"); + Plugin.LogProxy.Error("Failed to convert"); return null; } } @@ -304,7 +307,7 @@ public static class EmoteCache catch (Exception ex) { Failed = true; - Plugin.Log.Error(ex, $"Unable to load {emote.Code} with id {emote.Id}"); + Plugin.LogProxy.Error(ex, $"Unable to load {emote.Code} with id {emote.Id}"); } } @@ -408,7 +411,7 @@ public static class EmoteCache catch (Exception ex) { Failed = true; - Plugin.Log.Error(ex, $"Unable to load {emote.Code} with id {emote.Id}"); + Plugin.LogProxy.Error(ex, $"Unable to load {emote.Code} with id {emote.Id}"); } } } diff --git a/HellionChat/FontManager.cs b/HellionChat/FontManager.cs index 809846f..9a25dcd 100644 --- a/HellionChat/FontManager.cs +++ b/HellionChat/FontManager.cs @@ -58,7 +58,7 @@ public class FontManager ); if (stream is null) { - Plugin.Log.Warning( + Plugin.LogProxy.Warning( "Hellion font resource missing — falling back to system default font." ); return null; @@ -237,7 +237,7 @@ public class FontManager // Atlas-toolkit throws span IO and validation failures; routing the // wider set through the fallback keeps a corrupt font config from // taking down the whole atlas build. - Plugin.Log.Warning( + Plugin.LogProxy.Warning( e, $"Configured {slot} font failed to load ({e.GetType().Name}), " + "falling back to NotoSansCjkRegular" diff --git a/HellionChat/GameFunctions/Chat.cs b/HellionChat/GameFunctions/Chat.cs index 4d75d99..aa6502c 100755 --- a/HellionChat/GameFunctions/Chat.cs +++ b/HellionChat/GameFunctions/Chat.cs @@ -236,7 +236,7 @@ internal sealed unsafe class Chat : IDisposable } catch (Exception ex) { - Plugin.Log.Error(ex, "Error in chat Activated event"); + Plugin.LogProxy.Error(ex, "Error in chat Activated event"); } }); } @@ -266,7 +266,7 @@ internal sealed unsafe class Chat : IDisposable } catch (Exception ex) { - Plugin.Log.Error(ex, "Error in chat Activated event"); + Plugin.LogProxy.Error(ex, "Error in chat Activated event"); } return 1; // Prevent vanilla chat log from gaining focus @@ -299,7 +299,7 @@ internal sealed unsafe class Chat : IDisposable { playerName = SeString.Parse(agent->TellPlayerName).TextValue; worldId = agent->TellWorldId; - Plugin.Log.Debug($"Detected tell target '[redacted]'@{worldId}"); + Plugin.LogProxy.Debug($"Detected tell target '[redacted]'@{worldId}"); } Plugin.CurrentTab.CurrentChannel = new UsedChannel @@ -358,7 +358,7 @@ internal sealed unsafe class Chat : IDisposable } catch (Exception ex) { - Plugin.Log.Error(ex, "Error in chat Activated event"); + Plugin.LogProxy.Error(ex, "Error in chat Activated event"); } } @@ -408,7 +408,7 @@ internal sealed unsafe class Chat : IDisposable } catch (Exception ex) { - Plugin.Log.Error(ex, "Error in chat Activated event"); + Plugin.LogProxy.Error(ex, "Error in chat Activated event"); } } @@ -624,7 +624,7 @@ internal sealed unsafe class Chat : IDisposable if (contentId == 0) { Plugin.ChatGui.PrintError(Language.Chat_SendTell_Error); - Plugin.Log.Warning( + Plugin.LogProxy.Warning( "Tried to send a tell with ContentId being 0, sorry this is an internal error." ); return; diff --git a/HellionChat/GameFunctions/GameFunctions.cs b/HellionChat/GameFunctions/GameFunctions.cs index 770e6f6..985fa16 100755 --- a/HellionChat/GameFunctions/GameFunctions.cs +++ b/HellionChat/GameFunctions/GameFunctions.cs @@ -215,7 +215,7 @@ internal unsafe class GameFunctions : IDisposable } catch (Exception e) { - Plugin.Log.Warning(e, "Unable to open adventurer plate"); + Plugin.LogProxy.Warning(e, "Unable to open adventurer plate"); return false; } } @@ -255,7 +255,7 @@ internal unsafe class GameFunctions : IDisposable var byteCount = System.Text.Encoding.UTF8.GetByteCount(ReplacementName); if (byteCount >= PlaceholderBufferSize) { - Plugin.Log.Warning( + Plugin.LogProxy.Warning( $"Replacement name too long for placeholder buffer ({byteCount} bytes >= {PlaceholderBufferSize}); falling back to original." ); ReplacementName = null; diff --git a/HellionChat/GameFunctions/KeybindManager.cs b/HellionChat/GameFunctions/KeybindManager.cs index 4b1bc78..f374f2a 100644 --- a/HellionChat/GameFunctions/KeybindManager.cs +++ b/HellionChat/GameFunctions/KeybindManager.cs @@ -507,7 +507,7 @@ internal unsafe class KeybindManager : IDisposable } catch (Exception ex) { - Plugin.Log.Error(ex, "Error in chat Activated event"); + Plugin.LogProxy.Error(ex, "Error in chat Activated event"); } } diff --git a/HellionChat/Ipc/ExtraChat.cs b/HellionChat/Ipc/ExtraChat.cs index 4258d54..f8a668c 100644 --- a/HellionChat/Ipc/ExtraChat.cs +++ b/HellionChat/Ipc/ExtraChat.cs @@ -62,7 +62,10 @@ public sealed class ExtraChat : IDisposable catch (Exception ex) { // ExtraChat is optional; IPC failure is normal when the plugin isn't loaded. - Plugin.Log.Verbose(ex, "ExtraChat IPC initial state query failed (peer not loaded?)"); + Plugin.LogProxy.Verbose( + ex, + "ExtraChat IPC initial state query failed (peer not loaded?)" + ); } } diff --git a/HellionChat/Message.cs b/HellionChat/Message.cs index 3453f03..154ba93 100755 --- a/HellionChat/Message.cs +++ b/HellionChat/Message.cs @@ -153,8 +153,8 @@ public partial class Message } catch (ArgumentException ex) { - Plugin.Log.Error(ex, "Failed to parse extra chat channel GUID"); - Plugin.Log.Error($"Byte Array: ${string.Join(", ", data[4..^1])}"); + Plugin.LogProxy.Error(ex, "Failed to parse extra chat channel GUID"); + Plugin.LogProxy.Error($"Byte Array: ${string.Join(", ", data[4..^1])}"); return Guid.Empty; } } @@ -251,7 +251,7 @@ public partial class Message AddChunkWithMessage( text.NewWithStyle(chunk.Source, chunk.Link, token.Value) ); - Plugin.Log.Debug( + Plugin.LogProxy.Debug( $"Invalid URL accepted by Regex but failed URI parsing: '{token.Value}'" ); } @@ -416,7 +416,7 @@ public partial class Message catch (Exception) { AddChunkWithMessage(text.NewWithStyle(chunk.Source, chunk.Link, split)); - Plugin.Log.Debug($"Failed to parse the text param: '{split}'"); + Plugin.LogProxy.Debug($"Failed to parse the text param: '{split}'"); } } } diff --git a/HellionChat/MessageManager.cs b/HellionChat/MessageManager.cs index 500337c..99a9bf1 100644 --- a/HellionChat/MessageManager.cs +++ b/HellionChat/MessageManager.cs @@ -91,7 +91,7 @@ internal class MessageManager : IAsyncDisposable await Task.Delay(100); if (PendingMessageThread.IsAlive) - Plugin.Log.Warning( + Plugin.LogProxy.Warning( "PendingMessageThread did not observe cancellation within 10s. " + "Worker remains on background thread; next plugin reload releases it." ); @@ -137,7 +137,7 @@ internal class MessageManager : IAsyncDisposable } catch (Exception ex) { - Plugin.Log.Error(ex, "Error processing pending message"); + Plugin.LogProxy.Error(ex, "Error processing pending message"); } } else @@ -182,10 +182,12 @@ internal class MessageManager : IAsyncDisposable // Mark failed messages as deleted to prevent retry attempts var failedIds = messages.FailedMessageIds(); - Plugin.Log.Info($"Marking {failedIds.Count} messages as deleted due to parse failures"); + Plugin.LogProxy.Info( + $"Marking {failedIds.Count} messages as deleted due to parse failures" + ); foreach (var msgId in messages.FailedMessageIds()) { - Plugin.Log.Debug($"Marking message '{msgId}' as deleted due to parse failure"); + Plugin.LogProxy.Debug($"Marking message '{msgId}' as deleted due to parse failure"); Store.DeleteMessage(msgId); } } @@ -201,10 +203,10 @@ internal class MessageManager : IAsyncDisposable } catch (Exception ex) { - Plugin.Log.Error(ex, "Error in FilterAllTabs"); + Plugin.LogProxy.Error(ex, "Error in FilterAllTabs"); } - Plugin.Log.Debug($"FilterAllTabs took {stopwatch.ElapsedMilliseconds}ms"); + Plugin.LogProxy.Debug($"FilterAllTabs took {stopwatch.ElapsedMilliseconds}ms"); }); } @@ -259,7 +261,7 @@ internal class MessageManager : IAsyncDisposable } catch (Exception ex) { - Plugin.Log.Error(ex, "Error in ContentIdResolver"); + Plugin.LogProxy.Error(ex, "Error in ContentIdResolver"); } } diff --git a/HellionChat/PayloadHandler.cs b/HellionChat/PayloadHandler.cs index 0bd4c56..6dac11a 100755 --- a/HellionChat/PayloadHandler.cs +++ b/HellionChat/PayloadHandler.cs @@ -131,7 +131,7 @@ public sealed class PayloadHandler } catch (Exception ex) { - Plugin.Log.Error(ex, "Error executing integration"); + Plugin.LogProxy.Error(ex, "Error executing integration"); } } @@ -535,7 +535,7 @@ public sealed class PayloadHandler ) ) { - Plugin.Log.Warning("Could not find DalamudLinkHandlers"); + Plugin.LogProxy.Warning("Could not find DalamudLinkHandlers"); return; } @@ -546,7 +546,7 @@ public sealed class PayloadHandler } catch (Exception ex) { - Plugin.Log.Error(ex, "Error executing DalamudLinkPayload handler"); + Plugin.LogProxy.Error(ex, "Error executing DalamudLinkPayload handler"); } } diff --git a/HellionChat/Themes/ThemeRegistry.cs b/HellionChat/Themes/ThemeRegistry.cs index 53b4610..90f0135 100644 --- a/HellionChat/Themes/ThemeRegistry.cs +++ b/HellionChat/Themes/ThemeRegistry.cs @@ -118,7 +118,7 @@ public sealed class ThemeRegistry catch (Exception ex) when (IsRecoverableFileLock(ex)) { // Editor mid-save: keep last known good, retry on next refresh. - Plugin.Log.Debug( + Plugin.LogProxy.Debug( $"Custom theme {Path.GetFileName(path)} is locked, keeping last known good" ); if (cached.Theme is not null) diff --git a/HellionChat/Util/AutoTranslate.cs b/HellionChat/Util/AutoTranslate.cs index fa4e0b5..80b4c01 100644 --- a/HellionChat/Util/AutoTranslate.cs +++ b/HellionChat/Util/AutoTranslate.cs @@ -62,7 +62,7 @@ internal static class AutoTranslate { var sw = Stopwatch.StartNew(); AllEntries(); - Plugin.Log.Debug($"Warming up auto-translate took {sw.ElapsedMilliseconds}ms"); + Plugin.LogProxy.Debug($"Warming up auto-translate took {sw.ElapsedMilliseconds}ms"); }) { IsBackground = true, @@ -197,7 +197,7 @@ internal static class AutoTranslate } catch (Exception ex) { - Plugin.Log.Error(ex, $"failed to translate: {lookup}"); + Plugin.LogProxy.Error(ex, $"failed to translate: {lookup}"); } } diff --git a/HellionChat/Util/DalamudPluginLogProxy.cs b/HellionChat/Util/DalamudPluginLogProxy.cs index 00e4347..a6e9ad6 100644 --- a/HellionChat/Util/DalamudPluginLogProxy.cs +++ b/HellionChat/Util/DalamudPluginLogProxy.cs @@ -13,28 +13,49 @@ internal sealed class DalamudPluginLogProxy : IPluginLogProxy public void Verbose(Exception exception, string message) => _log.Verbose(exception, message); + public void Verbose(string messageTemplate, params object[] values) => + _log.Verbose(messageTemplate, values); + public void Debug(string message) => _log.Debug(message); public void Debug(Exception exception, string message) => _log.Debug(exception, message); + public void Debug(string messageTemplate, params object[] values) => + _log.Debug(messageTemplate, values); + public void Information(string message) => _log.Information(message); public void Information(Exception exception, string message) => _log.Information(exception, message); + public void Information(string messageTemplate, params object[] values) => + _log.Information(messageTemplate, values); + public void Info(string message) => _log.Info(message); public void Info(Exception exception, string message) => _log.Info(exception, message); + public void Info(string messageTemplate, params object[] values) => + _log.Info(messageTemplate, values); + public void Warning(string message) => _log.Warning(message); public void Warning(Exception exception, string message) => _log.Warning(exception, message); + public void Warning(string messageTemplate, params object[] values) => + _log.Warning(messageTemplate, values); + public void Error(string message) => _log.Error(message); public void Error(Exception exception, string message) => _log.Error(exception, message); + public void Error(string messageTemplate, params object[] values) => + _log.Error(messageTemplate, values); + public void Fatal(string message) => _log.Fatal(message); public void Fatal(Exception exception, string message) => _log.Fatal(exception, message); + + public void Fatal(string messageTemplate, params object[] values) => + _log.Fatal(messageTemplate, values); } diff --git a/HellionChat/Util/IPluginLogProxy.cs b/HellionChat/Util/IPluginLogProxy.cs index 630b5e5..40fd4bc 100644 --- a/HellionChat/Util/IPluginLogProxy.cs +++ b/HellionChat/Util/IPluginLogProxy.cs @@ -10,24 +10,31 @@ internal interface IPluginLogProxy { void Verbose(string message); void Verbose(Exception exception, string message); + void Verbose(string messageTemplate, params object[] values); void Debug(string message); void Debug(Exception exception, string message); + void Debug(string messageTemplate, params object[] values); void Information(string message); void Information(Exception exception, string message); + void Information(string messageTemplate, params object[] values); // IPluginLog exposes Info as a distinct method (short alias of // Information) — both are present so call-sites stay drop-in. void Info(string message); void Info(Exception exception, string message); + void Info(string messageTemplate, params object[] values); void Warning(string message); void Warning(Exception exception, string message); + void Warning(string messageTemplate, params object[] values); void Error(string message); void Error(Exception exception, string message); + void Error(string messageTemplate, params object[] values); void Fatal(string message); void Fatal(Exception exception, string message); + void Fatal(string messageTemplate, params object[] values); } diff --git a/HellionChat/Util/MemoryUtil.cs b/HellionChat/Util/MemoryUtil.cs index cfd9885..cba3f45 100644 --- a/HellionChat/Util/MemoryUtil.cs +++ b/HellionChat/Util/MemoryUtil.cs @@ -42,6 +42,6 @@ public static class MemoryUtil str.Append(' '); } - Plugin.Log.Information(str.ToString()); + Plugin.LogProxy.Information(str.ToString()); } } diff --git a/HellionChat/Util/WrapperUtil.cs b/HellionChat/Util/WrapperUtil.cs index 4a4270c..4c44d89 100644 --- a/HellionChat/Util/WrapperUtil.cs +++ b/HellionChat/Util/WrapperUtil.cs @@ -21,12 +21,12 @@ public static class WrapperUtil { try { - Plugin.Log.Debug($"Opening URI {uri} in default browser"); + Plugin.LogProxy.Debug($"Opening URI {uri} in default browser"); Plugin.PlatformUtil.OpenLink(uri.ToString()); } catch (Exception ex) { - Plugin.Log.Error($"Error opening URI: {ex}"); + Plugin.LogProxy.Error($"Error opening URI: {ex}"); AddNotification(Language.Context_OpenInBrowserError, NotificationType.Error); } }