feat: add logger class
This commit is contained in:
parent
9bfb7dc12e
commit
4b14302bf7
@ -66,7 +66,7 @@ namespace XivCommon.Functions {
|
||||
try {
|
||||
return this.AddBattleTalkDetourInner(uiModule, senderPtr, messagePtr, duration, style);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception in BattleTalk detour");
|
||||
Logger.LogError(ex, "Exception in BattleTalk detour");
|
||||
}
|
||||
|
||||
Return:
|
||||
@ -89,7 +89,7 @@ namespace XivCommon.Functions {
|
||||
try {
|
||||
this.OnBattleTalk?.Invoke(ref sender, ref message, ref options, ref handled);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.Log(ex, "Exception in BattleTalk event");
|
||||
Logger.LogError(ex, "Exception in BattleTalk event");
|
||||
}
|
||||
|
||||
if (handled) {
|
||||
|
@ -89,7 +89,7 @@ namespace XivCommon.Functions {
|
||||
try {
|
||||
this.OpenChatBubbleDetourInner(manager, actor, text, a4);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception in chat bubble detour");
|
||||
Logger.LogError(ex, "Exception in chat bubble detour");
|
||||
this.OpenChatBubbleHook!.Original(manager, actor, text, a4);
|
||||
}
|
||||
}
|
||||
@ -104,7 +104,7 @@ namespace XivCommon.Functions {
|
||||
try {
|
||||
this.OnChatBubble?.Invoke(ref actor, ref text);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception in chat bubble event");
|
||||
Logger.LogError(ex, "Exception in chat bubble event");
|
||||
}
|
||||
|
||||
var newText = text.Encode().Terminate();
|
||||
@ -120,7 +120,7 @@ namespace XivCommon.Functions {
|
||||
try {
|
||||
this.UpdateChatBubbleDetourInner(bubble, actor, a3);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception in update chat bubble detour");
|
||||
Logger.LogError(ex, "Exception in update chat bubble detour");
|
||||
this.UpdateChatBubbleHook!.Original(bubble, actor, a3);
|
||||
}
|
||||
}
|
||||
@ -132,7 +132,7 @@ namespace XivCommon.Functions {
|
||||
try {
|
||||
this.OnUpdateBubble?.Invoke(ref actor);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception in chat bubble update event");
|
||||
Logger.LogError(ex, "Exception in chat bubble update event");
|
||||
}
|
||||
|
||||
this.UpdateChatBubbleHook!.Original(bubble, actor.Address, a3);
|
||||
|
@ -121,7 +121,7 @@ namespace XivCommon.Functions {
|
||||
this.JoinParty?.Invoke(listing);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception in PF join detour");
|
||||
Logger.LogError(ex, "Exception in PF join detour");
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -77,7 +77,7 @@ namespace XivCommon.Functions {
|
||||
try {
|
||||
this.AddonTalkV45DetourInner(data);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception in Talk detour");
|
||||
Logger.LogError(ex, "Exception in Talk detour");
|
||||
}
|
||||
|
||||
Return:
|
||||
@ -95,7 +95,7 @@ namespace XivCommon.Functions {
|
||||
try {
|
||||
this.OnTalk?.Invoke(ref name, ref text, ref style);
|
||||
} catch (Exception ex) {
|
||||
PluginLog.LogError(ex, "Exception in Talk event");
|
||||
Logger.LogError(ex, "Exception in Talk event");
|
||||
}
|
||||
|
||||
var newName = name.Encode().Terminate();
|
||||
|
26
XivCommon/Logger.cs
Executable file
26
XivCommon/Logger.cs
Executable file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using Dalamud.Plugin;
|
||||
|
||||
namespace XivCommon {
|
||||
internal static class Logger {
|
||||
private static string Format(string msg) {
|
||||
return $"[XIVCommon] {msg}";
|
||||
}
|
||||
|
||||
internal static void Log(string msg) {
|
||||
PluginLog.Log(Format(msg));
|
||||
}
|
||||
|
||||
internal static void LogWarning(string msg) {
|
||||
PluginLog.LogWarning(Format(msg));
|
||||
}
|
||||
|
||||
internal static void LogError(string msg) {
|
||||
PluginLog.LogError(Format(msg));
|
||||
}
|
||||
|
||||
internal static void LogError(Exception ex, string msg) {
|
||||
PluginLog.LogError(ex, Format(msg));
|
||||
}
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ namespace XivCommon {
|
||||
}
|
||||
|
||||
internal static void PrintMissingSig(string name) {
|
||||
PluginLog.LogWarning($"Could not find signature for {name}. This functionality will be disabled.");
|
||||
Logger.LogWarning($"Could not find signature for {name}. This functionality will be disabled.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user