Cleanup logging in guidebook embeds (#37794)

This commit is contained in:
Tayrtahn
2025-05-24 18:47:47 -04:00
committed by GitHub
parent a9f36e6592
commit 05d3d9350d
8 changed files with 34 additions and 12 deletions

View File

@@ -22,10 +22,12 @@ namespace Content.Client.Guidebook.Controls;
public sealed partial class GuideTechnologyEmbed : BoxContainer, IDocumentTag, ISearchableControl
{
[Dependency] private readonly IEntitySystemManager _systemManager = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
private readonly ResearchSystem _research;
private readonly SpriteSystem _sprite;
private readonly ISawmill _sawmill;
public GuideTechnologyEmbed()
{
@@ -33,6 +35,7 @@ public sealed partial class GuideTechnologyEmbed : BoxContainer, IDocumentTag, I
IoCManager.InjectDependencies(this);
_research = _systemManager.GetEntitySystem<ResearchSystem>();
_sprite = _systemManager.GetEntitySystem<SpriteSystem>();
_sawmill = _logManager.GetSawmill("guidebook.technology");
MouseFilter = MouseFilterMode.Stop;
}
@@ -61,13 +64,13 @@ public sealed partial class GuideTechnologyEmbed : BoxContainer, IDocumentTag, I
control = null;
if (!args.TryGetValue("Technology", out var id))
{
Logger.Error("Technology embed tag is missing technology prototype argument");
_sawmill.Error("Technology embed tag is missing technology prototype argument");
return false;
}
if (!_prototype.TryIndex<TechnologyPrototype>(id, out var technology))
{
Logger.Error($"Specified technology prototype \"{id}\" is not a valid technology prototype");
_sawmill.Error($"Specified technology prototype \"{id}\" is not a valid technology prototype");
return false;
}