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

@@ -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);
}
}