mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
feat: add logging to DalamudPluginInterface, so plugins don't have to get Serilog
This commit is contained in:
parent
afb2e39944
commit
3a688b9219
1 changed files with 34 additions and 0 deletions
|
|
@ -109,5 +109,39 @@ namespace Dalamud.Plugin
|
||||||
|
|
||||||
return this.dalamud.Configuration.PluginConfigurations[this.pluginName] as IPluginConfiguration;
|
return this.dalamud.Configuration.PluginConfigurations[this.pluginName] as IPluginConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Logging
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Log a templated message to the in-game debug log.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
|
/// <param name="values">Values to log.</param>
|
||||||
|
public void Log(string messageTemplate, params object[] values) {
|
||||||
|
Serilog.Log.Information(messageTemplate, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Log a templated error message to the in-game debug log.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
|
/// <param name="values">Values to log.</param>
|
||||||
|
public void LogError(string messageTemplate, params object[] values)
|
||||||
|
{
|
||||||
|
Serilog.Log.Error(messageTemplate, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Log a templated error message to the in-game debug log.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="exception">The exception that caused the error.</param>
|
||||||
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
|
/// <param name="values">Values to log.</param>
|
||||||
|
public void LogError(Exception exception, string messageTemplate, params object[] values)
|
||||||
|
{
|
||||||
|
Serilog.Log.Error(exception, messageTemplate, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue