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:
@@ -2,6 +2,7 @@ using System;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace HellionChat.Integrations;
|
||||
@@ -23,7 +24,7 @@ internal sealed class HonorificService : IDisposable
|
||||
private readonly ICallGateSubscriber<object> _ready;
|
||||
private readonly ICallGateSubscriber<object> _disposing;
|
||||
|
||||
private readonly IPluginLog _log;
|
||||
private readonly ILogger<HonorificService> _logger;
|
||||
private readonly IFramework _framework;
|
||||
private bool _versionWarningLogged;
|
||||
|
||||
@@ -34,12 +35,12 @@ internal sealed class HonorificService : IDisposable
|
||||
|
||||
public HonorificService(
|
||||
IDalamudPluginInterface pluginInterface,
|
||||
IPluginLog log,
|
||||
ILogger<HonorificService> logger,
|
||||
IFramework framework
|
||||
)
|
||||
{
|
||||
_framework = framework;
|
||||
_log = log;
|
||||
_logger = logger;
|
||||
|
||||
// Gate objects are cached per-name by Dalamud and safe to register
|
||||
// before Honorific loads — they just won't fire until it does.
|
||||
@@ -84,7 +85,7 @@ internal sealed class HonorificService : IDisposable
|
||||
{
|
||||
if (!_versionWarningLogged)
|
||||
{
|
||||
_log.Warning(
|
||||
_logger.LogWarning(
|
||||
"Honorific API version mismatch — expected major 3, "
|
||||
+ "found {Major}.{Minor}. Disabling Honorific integration.",
|
||||
version.Item1,
|
||||
@@ -104,7 +105,7 @@ internal sealed class HonorificService : IDisposable
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Honorific not installed or not yet initialised — Ready will retry.
|
||||
_log.Debug(ex, "Honorific not available at HellionChat startup; awaiting Ready.");
|
||||
_logger.LogDebug(ex, "Honorific not available at HellionChat startup; awaiting Ready.");
|
||||
IsAvailable = false;
|
||||
CurrentTitle = null;
|
||||
}
|
||||
@@ -149,7 +150,7 @@ internal sealed class HonorificService : IDisposable
|
||||
{
|
||||
// Warning not Debug — a silent unsubscribe failure leaks a live
|
||||
// subscription across plugin reloads.
|
||||
_log.Warning(
|
||||
_logger.LogWarning(
|
||||
ex,
|
||||
"Honorific unsubscribe failed (likely API break or gate already gone)."
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user