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

@@ -35,8 +35,6 @@ public abstract class SharedAnomalySystem : EntitySystem
[Dependency] protected readonly SharedPopupSystem Popup = default!;
[Dependency] private readonly IRobustRandom _random = default!;
private ISawmill _sawmill = default!;
public override void Initialize()
{
base.Initialize();
@@ -45,8 +43,6 @@ public abstract class SharedAnomalySystem : EntitySystem
SubscribeLocalEvent<AnomalyComponent, AttackedEvent>(OnAttacked);
SubscribeLocalEvent<AnomalyComponent, MeleeThrowOnHitStartEvent>(OnAnomalyThrowStart);
SubscribeLocalEvent<AnomalyComponent, MeleeThrowOnHitEndEvent>(OnAnomalyThrowEnd);
_sawmill = Logger.GetSawmill("anomaly");
}
private void OnInteractHand(EntityUid uid, AnomalyComponent component, InteractHandEvent args)
@@ -98,7 +94,7 @@ public abstract class SharedAnomalySystem : EntitySystem
component.NextPulseTime = Timing.CurTime + GetPulseLength(component) * variation;
if (_net.IsServer)
_sawmill.Info($"Performing anomaly pulse. Entity: {ToPrettyString(uid)}");
Log.Info($"Performing anomaly pulse. Entity: {ToPrettyString(uid)}");
// if we are above the growth threshold, then grow before the pulse
if (component.Stability > component.GrowthThreshold)
@@ -135,7 +131,7 @@ public abstract class SharedAnomalySystem : EntitySystem
AdminLog.Add(LogType.Anomaly, LogImpact.Extreme, $"Anomaly {ToPrettyString(uid)} began to go supercritical.");
if (_net.IsServer)
_sawmill.Info($"Anomaly is going supercritical. Entity: {ToPrettyString(uid)}");
Log.Info($"Anomaly is going supercritical. Entity: {ToPrettyString(uid)}");
var super = AddComp<AnomalySupercriticalComponent>(uid);
super.EndTime = Timing.CurTime + super.SupercriticalDuration;
@@ -161,7 +157,7 @@ public abstract class SharedAnomalySystem : EntitySystem
Audio.PlayPvs(component.SupercriticalSound, uid);
if (_net.IsServer)
_sawmill.Info($"Raising supercritical event. Entity: {ToPrettyString(uid)}");
Log.Info($"Raising supercritical event. Entity: {ToPrettyString(uid)}");
var ev = new AnomalySupercriticalEvent(uid);
RaiseLocalEvent(uid, ref ev, true);
@@ -179,7 +175,7 @@ public abstract class SharedAnomalySystem : EntitySystem
{
// Logging before resolve, in case the anomaly has deleted itself.
if (_net.IsServer)
_sawmill.Info($"Ending anomaly. Entity: {ToPrettyString(uid)}");
Log.Info($"Ending anomaly. Entity: {ToPrettyString(uid)}");
AdminLog.Add(LogType.Anomaly, supercritical ? LogImpact.High : LogImpact.Low,
$"Anomaly {ToPrettyString(uid)} {(supercritical ? "went supercritical" : "decayed")}.");