mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-17 13:27:43 +01:00
Fix log filtering with IPluginLog
- Rename `PluginLog`'s property to `Dalamud.PluginName` to match what `IPluginLog` is doing. - Change `ModuleLog` to use `Dalamud.ModuleName` as its context property. - Update the Console window to handle both changes. - Add the ability to filter to only Dalamud module log messages.
This commit is contained in:
parent
40b875c8e9
commit
764e0a81b7
3 changed files with 31 additions and 16 deletions
|
|
@ -12,6 +12,10 @@ public class ModuleLog
|
|||
{
|
||||
private readonly string moduleName;
|
||||
private readonly ILogger moduleLogger;
|
||||
|
||||
// FIXME (v9): Deprecate this class in favor of using contextualized ILoggers with proper formatting.
|
||||
// We can keep this class around as a Serilog helper, but ModuleLog should no longer be a returned
|
||||
// type, instead returning a (prepared) ILogger appropriately.
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModuleLog"/> class.
|
||||
|
|
@ -20,10 +24,8 @@ public class ModuleLog
|
|||
/// <param name="moduleName">The module name.</param>
|
||||
public ModuleLog(string? moduleName)
|
||||
{
|
||||
// FIXME: Should be namespaced better, e.g. `Dalamud.PluginLoader`, but that becomes a relatively large
|
||||
// change.
|
||||
this.moduleName = moduleName ?? "DalamudInternal";
|
||||
this.moduleLogger = Log.ForContext("SourceContext", this.moduleName);
|
||||
this.moduleLogger = Log.ForContext("Dalamud.ModuleName", this.moduleName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -128,7 +130,8 @@ public class ModuleLog
|
|||
public void Fatal(Exception exception, string messageTemplate, params object[] values)
|
||||
=> this.WriteLog(LogEventLevel.Fatal, messageTemplate, exception, values);
|
||||
|
||||
private void WriteLog(LogEventLevel level, string messageTemplate, Exception? exception = null, params object[] values)
|
||||
private void WriteLog(
|
||||
LogEventLevel level, string messageTemplate, Exception? exception = null, params object[] values)
|
||||
{
|
||||
// FIXME: Eventually, the `pluginName` tag should be removed from here and moved over to the actual log
|
||||
// formatter.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue