mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
feat: add new PluginLog methods
This commit is contained in:
parent
e3d6b91d8b
commit
b355f9243c
2 changed files with 52 additions and 0 deletions
|
|
@ -122,6 +122,7 @@ namespace Dalamud.Plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="messageTemplate">The message template.</param>
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
/// <param name="values">Values to log.</param>
|
/// <param name="values">Values to log.</param>
|
||||||
|
[Obsolete]
|
||||||
public void Log(string messageTemplate, params object[] values) {
|
public void Log(string messageTemplate, params object[] values) {
|
||||||
Serilog.Log.Information(messageTemplate, values);
|
Serilog.Log.Information(messageTemplate, values);
|
||||||
}
|
}
|
||||||
|
|
@ -131,6 +132,7 @@ namespace Dalamud.Plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="messageTemplate">The message template.</param>
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
/// <param name="values">Values to log.</param>
|
/// <param name="values">Values to log.</param>
|
||||||
|
[Obsolete]
|
||||||
public void LogError(string messageTemplate, params object[] values)
|
public void LogError(string messageTemplate, params object[] values)
|
||||||
{
|
{
|
||||||
Serilog.Log.Error(messageTemplate, values);
|
Serilog.Log.Error(messageTemplate, values);
|
||||||
|
|
@ -142,6 +144,7 @@ namespace Dalamud.Plugin
|
||||||
/// <param name="exception">The exception that caused the error.</param>
|
/// <param name="exception">The exception that caused the error.</param>
|
||||||
/// <param name="messageTemplate">The message template.</param>
|
/// <param name="messageTemplate">The message template.</param>
|
||||||
/// <param name="values">Values to log.</param>
|
/// <param name="values">Values to log.</param>
|
||||||
|
[Obsolete]
|
||||||
public void LogError(Exception exception, string messageTemplate, params object[] values)
|
public void LogError(Exception exception, string messageTemplate, params object[] values)
|
||||||
{
|
{
|
||||||
Serilog.Log.Error(exception, messageTemplate, values);
|
Serilog.Log.Error(exception, messageTemplate, values);
|
||||||
|
|
|
||||||
49
Dalamud/Plugin/PluginLog.cs
Normal file
49
Dalamud/Plugin/PluginLog.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Dalamud.Plugin
|
||||||
|
{
|
||||||
|
public static class PluginLog
|
||||||
|
{
|
||||||
|
/// <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 static void Log(string messageTemplate, params object[] values)
|
||||||
|
{
|
||||||
|
var name = Assembly.GetCallingAssembly().GetName().Name;
|
||||||
|
|
||||||
|
Serilog.Log.Information($"[{name}] {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 static void LogError(string messageTemplate, params object[] values)
|
||||||
|
{
|
||||||
|
var name = Assembly.GetCallingAssembly().GetName().Name;
|
||||||
|
|
||||||
|
Serilog.Log.Error($"[{name}] {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 static void LogError(Exception exception, string messageTemplate, params object[] values)
|
||||||
|
{
|
||||||
|
var name = Assembly.GetCallingAssembly().GetName().Name;
|
||||||
|
|
||||||
|
Serilog.Log.Error(exception, $"[{name}] {messageTemplate}", values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue