Re-add SourceContext property check

Technically an API breakage, some plugins are passing this for logging. Slated for removal in API 9, however.
This commit is contained in:
Kaz Wolfe 2023-09-12 18:33:41 -07:00
parent 764e0a81b7
commit 8911d4ebc2
No known key found for this signature in database
GPG key ID: 258813F53A16EBB4

View file

@ -504,14 +504,16 @@ internal class ConsoleWindow : Window, IDisposable
HasException = logEvent.Exception != null,
};
// TODO (v9): Remove SourceContext property check.
if (logEvent.Properties.ContainsKey("Dalamud.ModuleName"))
{
entry.Source = "DalamudInternal";
}
else if (logEvent.Properties.TryGetValue("Dalamud.PluginName", out var sourceProp) &&
sourceProp is ScalarValue { Value: string value })
else if ((logEvent.Properties.TryGetValue("Dalamud.PluginName", out var sourceProp) ||
logEvent.Properties.TryGetValue("SourceContext", out sourceProp)) &&
sourceProp is ScalarValue { Value: string sourceValue })
{
entry.Source = value;
entry.Source = sourceValue;
}
this.logText.Add(entry);