forked from Eauldane/SnowcloakClient
Initial
This commit is contained in:
26
Glamourer.Api/Helpers/PluginLogHelper.cs
Normal file
26
Glamourer.Api/Helpers/PluginLogHelper.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Glamourer.Api.Helpers;
|
||||
|
||||
internal class PluginLogHelper
|
||||
{
|
||||
[PluginService]
|
||||
private static IPluginLog? _log { get; set; }
|
||||
|
||||
private PluginLogHelper(IDalamudPluginInterface pi)
|
||||
=> pi.Inject(this);
|
||||
|
||||
public static void WriteError(IDalamudPluginInterface pi, string errorMessage)
|
||||
=> GetLog(pi).Error(errorMessage);
|
||||
|
||||
public static IPluginLog GetLog(IDalamudPluginInterface pi)
|
||||
{
|
||||
if (_log != null)
|
||||
return _log;
|
||||
|
||||
_ = new PluginLogHelper(pi);
|
||||
return _log!;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user