Unify Content's EntitySystem logging (#26216)

Use Log with generated sawmill name rather than explicitly named one for all non rule-based Content EntitySystems.
This commit is contained in:
LordCarve
2024-03-17 21:30:27 +01:00
committed by GitHub
parent 4357b9ef08
commit eeaea6c25b
13 changed files with 43 additions and 82 deletions

View File

@@ -14,8 +14,6 @@ public sealed partial class NpcFactionSystem : EntitySystem
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
private ISawmill _sawmill = default!;
/// <summary>
/// To avoid prototype mutability we store an intermediary data class that gets used instead.
/// </summary>
@@ -24,7 +22,7 @@ public sealed partial class NpcFactionSystem : EntitySystem
public override void Initialize()
{
base.Initialize();
_sawmill = Logger.GetSawmill("faction");
SubscribeLocalEvent<NpcFactionMemberComponent, ComponentStartup>(OnFactionStartup);
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnProtoReload);
@@ -69,7 +67,7 @@ public sealed partial class NpcFactionSystem : EntitySystem
{
if (!_protoManager.HasIndex<NpcFactionPrototype>(faction))
{
_sawmill.Error($"Unable to find faction {faction}");
Log.Error($"Unable to find faction {faction}");
return;
}
@@ -90,7 +88,7 @@ public sealed partial class NpcFactionSystem : EntitySystem
{
if (!_protoManager.HasIndex<NpcFactionPrototype>(faction))
{
_sawmill.Error($"Unable to find faction {faction}");
Log.Error($"Unable to find faction {faction}");
return;
}
@@ -213,13 +211,13 @@ public sealed partial class NpcFactionSystem : EntitySystem
{
if (!_factions.TryGetValue(source, out var sourceFaction))
{
_sawmill.Error($"Unable to find faction {source}");
Log.Error($"Unable to find faction {source}");
return;
}
if (!_factions.ContainsKey(target))
{
_sawmill.Error($"Unable to find faction {target}");
Log.Error($"Unable to find faction {target}");
return;
}
@@ -255,13 +253,13 @@ public sealed partial class NpcFactionSystem : EntitySystem
{
if (!_factions.TryGetValue(source, out var sourceFaction))
{
_sawmill.Error($"Unable to find faction {source}");
Log.Error($"Unable to find faction {source}");
return;
}
if (!_factions.ContainsKey(target))
{
_sawmill.Error($"Unable to find faction {target}");
Log.Error($"Unable to find faction {target}");
return;
}