refactor: use new plugin log

This commit is contained in:
Anna 2023-10-14 19:32:10 -04:00
parent 45fe83f1b0
commit 357bc2bb6f
Signed by: anna
GPG Key ID: D0943384CD9F87D1
8 changed files with 13 additions and 20 deletions

View File

@ -1,5 +1,4 @@
using Dalamud.Game.Command;
using Dalamud.Logging;
namespace ChatTwo;
@ -45,14 +44,14 @@ internal sealed class Commands : IDisposable {
private void Invoke(string command, string arguments) {
if (!this.Registered.TryGetValue(command, out var wrapper)) {
PluginLog.Warning($"Missing registration for command {command}");
Plugin.Log.Warning($"Missing registration for command {command}");
return;
}
try {
wrapper.Invoke(command, arguments);
} catch (Exception ex) {
PluginLog.Error(ex, $"Error while executing command {command}");
Plugin.Log.Error(ex, $"Error while executing command {command}");
}
}
}

View File

@ -2,7 +2,6 @@ using ChatTwo.Code;
using ChatTwo.Resources;
using ChatTwo.Ui;
using Dalamud.Configuration;
using Dalamud.Logging;
using ImGuiNET;
namespace ChatTwo;
@ -124,7 +123,7 @@ internal class Configuration : IPluginConfiguration {
break;
default:
PluginLog.Warning($"Couldn't migrate config version {this.Version}");
Plugin.Log.Warning($"Couldn't migrate config version {this.Version}");
loop = false;
break;
}

View File

@ -6,7 +6,6 @@ using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.Config;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Hooking;
using Dalamud.Logging;
using Dalamud.Memory;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures;
@ -432,7 +431,7 @@ internal sealed unsafe class Chat : IDisposable {
TellReason = TellReason.Reply,
});
} catch (Exception ex) {
PluginLog.LogError(ex, "Error in chat Activated event");
Plugin.Log.Error(ex, "Error in chat Activated event");
}
}
}
@ -483,7 +482,7 @@ internal sealed unsafe class Chat : IDisposable {
};
this.Activated?.Invoke(args);
} catch (Exception ex) {
PluginLog.LogError(ex, "Error in chat Activated event");
Plugin.Log.Error(ex, "Error in chat Activated event");
}
// prevent the game from focusing the chat log
@ -566,7 +565,7 @@ internal sealed unsafe class Chat : IDisposable {
TellTarget = target,
});
} catch (Exception ex) {
PluginLog.LogError(ex, "Error in chat Activated event");
Plugin.Log.Error(ex, "Error in chat Activated event");
}
}

View File

@ -9,7 +9,6 @@ using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Logging;
using Dalamud.Utility;
using ImGuiNET;
using Lumina.Excel.GeneratedSheets;
@ -101,7 +100,7 @@ internal sealed class PayloadHandler {
try {
this.Ui.Plugin.Ipc.Invoke(id, sender, contentId, payload, chunk.Message?.SenderSource, chunk.Message?.ContentSource);
} catch (Exception ex) {
PluginLog.Error(ex, "Error executing integration");
Plugin.Log.Error(ex, "Error executing integration");
}
}
@ -354,7 +353,7 @@ internal sealed class PayloadHandler {
try {
action(link.CommandId, new SeString(payloads));
} catch (Exception ex) {
PluginLog.LogError(ex, "Error executing DalamudLinkPayload handler");
Plugin.Log.Error(ex, "Error executing DalamudLinkPayload handler");
}
}

View File

@ -3,7 +3,6 @@ using System.Runtime.InteropServices;
using ChatTwo.Ui;
using Dalamud.Interface;
using Dalamud.Interface.GameFonts;
using Dalamud.Logging;
using ImGuiNET;
namespace ChatTwo;
@ -151,7 +150,7 @@ internal sealed class PluginUi : IDisposable {
try {
component.Draw();
} catch (Exception ex) {
PluginLog.LogError(ex, "Error drawing component");
Plugin.Log.Error(ex, "Error drawing component");
}
}

View File

@ -6,7 +6,6 @@ using ChatTwo.Resources;
using ChatTwo.Util;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Logging;
using Dalamud.Plugin.Services;
using ImGuiNET;
using LiteDB;
@ -250,7 +249,7 @@ internal class Store : IDisposable {
var lastId = ObjectId.Empty;
for (var i = 0; i < rounds; i++) {
this._migrateCurrent = i + 1;
PluginLog.Log($"Update round {i + 1}/{rounds}");
Plugin.Log.Info($"Update round {i + 1}/{rounds}");
var messages = this.Messages.Query()
.OrderBy(msg => msg.Id)
.Where(msg => msg.Id > lastId)

View File

@ -13,7 +13,6 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Logging;
using Dalamud.Memory;
using ImGuiNET;
using Lumina.Excel.GeneratedSheets;
@ -328,7 +327,7 @@ internal sealed class ChatLog : IUiComponent {
TellReason = reason,
});
} catch (Exception ex) {
PluginLog.LogError(ex, "Error in chat Activated event");
Plugin.Log.Error(ex, "Error in chat Activated event");
}
}
}

View File

@ -23,10 +23,10 @@ internal sealed class ChatColours : ISettingsTab {
.ToHashSet();
var total = Enum.GetValues<ChatType>().Where(type => !type.IsGm()).ToHashSet();
if (sortable.Count != total.Count) {
Dalamud.Logging.PluginLog.Warning($"There are {sortable.Count} sortable channels, but there are {total.Count} total channels.");
Dalamud.Logging.Plugin.Log.Warning($"There are {sortable.Count} sortable channels, but there are {total.Count} total channels.");
total.ExceptWith(sortable);
foreach (var missing in total) {
Dalamud.Logging.PluginLog.Log($"Missing {missing}");
Dalamud.Logging.Plugin.Log.Log($"Missing {missing}");
}
}
#endif