feat(util): add IPluginLogProxy interface and production wrapper
F12.2 closes the gap that F12.1 left open: MessageStore's ctor calls Plugin.Log.Information inside Migrate0, which prevents an isolated xUnit construction test (Dalamud.dll cannot load in the test AppDomain). The proxy mirrors IPluginLog's full surface (Verbose/Debug/Information/ Info/Warning/Error/Fatal — both Info and Information as Dalamud exposes them) with both single-string and Exception+string overloads, so the ~91 existing Plugin.Log.* call-sites become a drop-in rewrite to Plugin.LogProxy.*. A later DI-container adoption cycle (v1.5.x) may swap this for Microsoft.Extensions.Logging's ILogger<T>; this commit is the intermediate decorator step.
This commit is contained in:
@@ -117,6 +117,11 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
||||
// any service allocated in LoadAsync can read Plugin.PlatformUtil.
|
||||
internal static IPlatformUtil PlatformUtil { get; private set; } = null!;
|
||||
|
||||
// Log indirection over Dalamud's IPluginLog. Same rationale as PlatformUtil:
|
||||
// call-sites read through LogProxy so MessageStore can be tested in
|
||||
// isolation. Wired immediately after Dalamud injects Log.
|
||||
internal static IPluginLogProxy LogProxy { get; private set; } = null!;
|
||||
|
||||
// Idempotency guard — Dalamud may fire DisposeAsync twice in a reload race.
|
||||
private int _disposeStarted;
|
||||
|
||||
@@ -162,6 +167,7 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
||||
// needs Util.* — services then read Plugin.PlatformUtil instead of
|
||||
// hitting the Dalamud static surface directly.
|
||||
PlatformUtil = new DalamudPlatformUtil();
|
||||
LogProxy = new DalamudPluginLogProxy(Log);
|
||||
|
||||
// Schema gate: v1.4.x requires config v16. Users on older schemas
|
||||
// must install v1.4.2 first to run the migration chain.
|
||||
|
||||
Reference in New Issue
Block a user