refactor(di): migrate Integrations + IPC layer to ILogger<T> (DI-4 Slice B)
Seven services across Integrations/, Ipc/ and GameFunctions/ shift from Plugin.LogProxy to Microsoft.Extensions.Logging.ILogger<T>. Files with live LogProxy sites (10 in total): - Ipc/ExtraChat (1) - GameFunctions/Chat (6) - GameFunctions/GameFunctions (2) - GameFunctions/KeybindManager (1) Foundation-touch files (no current sites, ctor takes ILogger<T> as seed for the v1.5.7-11 Plugin-Integrations wave): - Integrations/HonorificService (also drops the local IPluginLog _log field in favour of ILogger<HonorificService> _logger; the three _log.* calls there are migrated as a bonus since the field had to change anyway) - IpcManager - Ipc/TypingIpc GameFunctions takes ILoggerFactory as an extra ctor arg so it can hand a typed logger to its nested Chat and KeybindManager (same pattern MessageStore + MessageEnumerator use in Slice A). PluginHostFactory factory lambdas updated for all five Slice B services that need extra resolves. Plan drift D8: GameFunctions.TryOpenAdventurerPlate is an internal static method whose only Warning call cannot reach the instance _logger. The one site stays on Plugin.LogProxy with an inline note; promoting it to instance + PayloadHandler.cs:814 call-site update is a v1.5.1+ cleanup, out of DI-4 Slice B scope.
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace HellionChat.Ipc;
|
||||
|
||||
public sealed class ExtraChat : IDisposable
|
||||
{
|
||||
private readonly ILogger<ExtraChat> _logger;
|
||||
|
||||
#pragma warning disable CS0649 // Assigned through IPC
|
||||
[Serializable]
|
||||
private struct OverrideInfo
|
||||
@@ -36,8 +39,9 @@ public sealed class ExtraChat : IDisposable
|
||||
private volatile Dictionary<Guid, string> ChannelNamesInternal = new();
|
||||
internal IReadOnlyDictionary<Guid, string> ChannelNames => ChannelNamesInternal;
|
||||
|
||||
internal ExtraChat()
|
||||
internal ExtraChat(ILogger<ExtraChat> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
OverrideChannelGate = Plugin.Interface.GetIpcSubscriber<OverrideInfo, object>(
|
||||
"ExtraChat.OverrideChannelColour"
|
||||
);
|
||||
@@ -62,10 +66,7 @@ public sealed class ExtraChat : IDisposable
|
||||
catch (Exception ex)
|
||||
{
|
||||
// ExtraChat is optional; IPC failure is normal when the plugin isn't loaded.
|
||||
Plugin.LogProxy.Verbose(
|
||||
ex,
|
||||
"ExtraChat IPC initial state query failed (peer not loaded?)"
|
||||
);
|
||||
_logger.LogTrace(ex, "ExtraChat IPC initial state query failed (peer not loaded?)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user