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:
@@ -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")}.");
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
private ISawmill _sawmill = default!;
|
||||
|
||||
public const string InvokedPort = "link_port";
|
||||
|
||||
@@ -25,7 +24,6 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
|
||||
SubscribeLocalEvent<DeviceLinkSinkComponent, ComponentStartup>(OnSinkStartup);
|
||||
SubscribeLocalEvent<DeviceLinkSourceComponent, ComponentRemove>(OnSourceRemoved);
|
||||
SubscribeLocalEvent<DeviceLinkSinkComponent, ComponentRemove>(OnSinkRemoved);
|
||||
_sawmill = Logger.GetSawmill("devicelink");
|
||||
}
|
||||
|
||||
#region Link Validation
|
||||
@@ -386,12 +384,12 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
|
||||
|
||||
if (sourceComponent == null)
|
||||
{
|
||||
_sawmill.Error($"Attempted to remove link between {ToPrettyString(sourceUid)} and {ToPrettyString(sinkUid)}, but the source component was missing.");
|
||||
Log.Error($"Attempted to remove link between {ToPrettyString(sourceUid)} and {ToPrettyString(sinkUid)}, but the source component was missing.");
|
||||
sinkComponent!.LinkedSources.Remove(sourceUid);
|
||||
}
|
||||
else
|
||||
{
|
||||
_sawmill.Error($"Attempted to remove link between {ToPrettyString(sourceUid)} and {ToPrettyString(sinkUid)}, but the sink component was missing.");
|
||||
Log.Error($"Attempted to remove link between {ToPrettyString(sourceUid)} and {ToPrettyString(sinkUid)}, but the sink component was missing.");
|
||||
sourceComponent.LinkedPorts.Remove(sourceUid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,10 @@ public sealed class ThirstSystem : EntitySystem
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
|
||||
[Dependency] private readonly SharedJetpackSystem _jetpack = default!;
|
||||
|
||||
private ISawmill _sawmill = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
_sawmill = Logger.GetSawmill("thirst");
|
||||
|
||||
SubscribeLocalEvent<ThirstComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed);
|
||||
SubscribeLocalEvent<ThirstComponent, MapInitEvent>(OnMapInit);
|
||||
SubscribeLocalEvent<ThirstComponent, RejuvenateEvent>(OnRejuvenate);
|
||||
@@ -156,7 +152,7 @@ public sealed class ThirstSystem : EntitySystem
|
||||
return;
|
||||
|
||||
default:
|
||||
_sawmill.Error($"No thirst threshold found for {component.CurrentThirstThreshold}");
|
||||
Log.Error($"No thirst threshold found for {component.CurrentThirstThreshold}");
|
||||
throw new ArgumentOutOfRangeException($"No thirst threshold found for {component.CurrentThirstThreshold}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user