Use Log with generated sawmill name rather than explicitly named one for all non rule-based Content EntitySystems.
private const float ReactTime = 0.125f;
- private ISawmill _sawmill = default!;
-
public override void Initialize()
{
base.Initialize();
- _sawmill = Logger.GetSawmill("vapor");
+
SubscribeLocalEvent<VaporComponent, StartCollideEvent>(HandleCollide);
}
if (reaction > reagentQuantity.Quantity)
{
- _sawmill.Error($"Tried to tile react more than we have for reagent {reagentQuantity}. Found {reaction} and we only have {reagentQuantity.Quantity}");
+ Log.Error($"Tried to tile react more than we have for reagent {reagentQuantity}. Found {reaction} and we only have {reagentQuantity.Quantity}");
reaction = reagentQuantity.Quantity;
}
-using System.Linq;
+using System.Linq;
using Content.Server.DeviceNetwork.Components;
using Content.Shared.DeviceNetwork;
using Content.Shared.DeviceNetwork.Components;
[UsedImplicitly]
public sealed class DeviceListSystem : SharedDeviceListSystem
{
- private ISawmill _sawmill = default!;
-
[Dependency] private readonly NetworkConfiguratorSystem _configurator = default!;
public override void Initialize()
SubscribeLocalEvent<DeviceListComponent, BeforeBroadcastAttemptEvent>(OnBeforeBroadcast);
SubscribeLocalEvent<DeviceListComponent, BeforePacketSentEvent>(OnBeforePacketSent);
SubscribeLocalEvent<BeforeSaveEvent>(OnMapSave);
- _sawmill = Logger.GetSawmill("devicelist");
}
private void OnShutdown(EntityUid uid, DeviceListComponent component, ComponentShutdown args)
// TODO full game saves.
// when full saves are supported, this should instead add data to the BeforeSaveEvent informing the
// saving system that this map (or null-space entity) also needs to be included in the save.
- _sawmill.Error(
+ Log.Error(
$"Saving a device list ({ToPrettyString(uid)}) that has a reference to an entity on another map ({ToPrettyString(ent)}). Removing entity from list.");
}
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
- private ISawmill _sawmill = default!;
-
public override void Initialize()
{
base.Initialize();
- _sawmill = Logger.GetSawmill("forensics.scanner");
-
SubscribeLocalEvent<ForensicScannerComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<ForensicScannerComponent, AfterInteractUsingEvent>(OnAfterInteractUsing);
SubscribeLocalEvent<ForensicScannerComponent, BeforeActivatableUIOpenEvent>(OnBeforeActivatableUIOpen);
component.PrintReadyAt);
if (!_uiSystem.TrySetUiState(uid, ForensicScannerUiKey.Key, state))
- _sawmill.Warning($"{ToPrettyString(uid)} was unable to set UI state.");
+ Log.Warning($"{ToPrettyString(uid)} was unable to set UI state.");
}
private void OnDoAfter(EntityUid uid, ForensicScannerComponent component, DoAfterEvent args)
{
if (!args.Session.AttachedEntity.HasValue)
{
- _sawmill.Warning($"{ToPrettyString(uid)} got OnPrint without Session.AttachedEntity");
+ Log.Warning($"{ToPrettyString(uid)} got OnPrint without Session.AttachedEntity");
return;
}
if (!HasComp<PaperComponent>(printed))
{
- _sawmill.Error("Printed paper did not have PaperComponent.");
+ Log.Error("Printed paper did not have PaperComponent.");
return;
}
-using System.IO;
+using System.IO;
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.CCVar;
/// <returns></returns>
private Dictionary<MapId, (TimeSpan next, string fileName)> _currentlyAutosaving = new();
- private ISawmill _sawmill = default!;
private bool _autosaveEnabled;
public override void Initialize()
"autosave <map> <path if enabling>",
ToggleAutosaveCommand);
- _sawmill = Logger.GetSawmill("autosave");
Subs.CVar(_cfg, CCVars.AutosaveEnabled, SetAutosaveEnabled, true);
}
if (!_mapManager.MapExists(map) || _mapManager.IsMapInitialized(map))
{
- _sawmill.Warning($"Can't autosave map {map}; it doesn't exist, or is initialized. Removing from autosave.");
+ Log.Warning($"Can't autosave map {map}; it doesn't exist, or is initialized. Removing from autosave.");
_currentlyAutosaving.Remove(map);
return;
}
var path = Path.Combine(saveDir, $"{DateTime.Now.ToString("yyyy-M-dd_HH.mm.ss")}-AUTO.yml");
_currentlyAutosaving[map] = (CalculateNextTime(), name);
- _sawmill.Info($"Autosaving map {name} ({map}) to {path}. Next save in {ReadableTimeLeft(map)} seconds.");
+ Log.Info($"Autosaving map {name} ({map}) to {path}. Next save in {ReadableTimeLeft(map)} seconds.");
_map.SaveMap(map, path);
}
}
{
if (!_mapManager.MapExists(map) || _mapManager.IsMapInitialized(map))
{
- _sawmill.Warning("Tried to enable autosaving on non-existant or already initialized map!");
+ Log.Warning("Tried to enable autosaving on non-existant or already initialized map!");
_currentlyAutosaving.Remove(map);
return;
}
- _sawmill.Info($"Started autosaving map {path} ({map}). Next save in {ReadableTimeLeft(map)} seconds.");
+ Log.Info($"Started autosaving map {path} ({map}). Next save in {ReadableTimeLeft(map)} seconds.");
}
else
{
_currentlyAutosaving.Remove(map);
- _sawmill.Info($"Stopped autosaving on map {map}");
+ Log.Info($"Stopped autosaving on map {map}");
}
}
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
- private ISawmill _sawmill = default!;
-
/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();
- _sawmill = Logger.GetSawmill("mech");
-
SubscribeLocalEvent<MechComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<MechComponent, EntInsertedIntoContainerMessage>(OnInsertBattery);
SubscribeLocalEvent<MechComponent, MapInitEvent>(OnMapInit);
_battery.SetCharge(battery!.Value, batteryComp.CurrentCharge + delta.Float(), batteryComp);
if (batteryComp.CurrentCharge != component.Energy) //if there's a discrepency, we have to resync them
{
- _sawmill.Debug($"Battery charge was not equal to mech charge. Battery {batteryComp.CurrentCharge}. Mech {component.Energy}");
+ Log.Debug($"Battery charge was not equal to mech charge. Battery {batteryComp.CurrentCharge}. Mech {component.Energy}");
component.Energy = batteryComp.CurrentCharge;
Dirty(component);
}
// Max ping I've had is 350ms from aus to spain.
public static readonly TimeSpan BufferTime = TimeSpan.FromMilliseconds(750);
- private ISawmill _sawmill = Logger.GetSawmill("lagcomp");
-
public override void Initialize()
{
base.Initialize();
- _sawmill.Level = LogLevel.Info;
+ Log.Level = LogLevel.Info;
SubscribeLocalEvent<LagCompensationComponent, MoveEvent>(OnLagMove);
}
if (coordinates == default)
{
- _sawmill.Debug($"No long comp coords found, using {xform.Coordinates}");
+ Log.Debug($"No long comp coords found, using {xform.Coordinates}");
coordinates = xform.Coordinates;
angle = xform.LocalRotation;
}
else
{
- _sawmill.Debug($"Actual coords is {xform.Coordinates} and got {coordinates}");
+ Log.Debug($"Actual coords is {xform.Coordinates} and got {coordinates}");
}
return (coordinates, angle);
[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>
public override void Initialize()
{
base.Initialize();
- _sawmill = Logger.GetSawmill("faction");
+
SubscribeLocalEvent<NpcFactionMemberComponent, ComponentStartup>(OnFactionStartup);
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnProtoReload);
{
if (!_protoManager.HasIndex<NpcFactionPrototype>(faction))
{
- _sawmill.Error($"Unable to find faction {faction}");
+ Log.Error($"Unable to find faction {faction}");
return;
}
{
if (!_protoManager.HasIndex<NpcFactionPrototype>(faction))
{
- _sawmill.Error($"Unable to find faction {faction}");
+ Log.Error($"Unable to find faction {faction}");
return;
}
{
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;
}
{
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;
}
[Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
- private ISawmill _sawmill = default!;
-
private const float ShuttleSpawnBuffer = 1f;
private bool _emergencyShuttleEnabled;
public override void Initialize()
{
- _sawmill = Logger.GetSawmill("shuttle.emergency");
_emergencyShuttleEnabled = _configManager.GetCVar(CCVars.EmergencyShuttleEnabled);
// Don't immediately invoke as roundstart will just handle it.
Subs.CVar(_configManager, CCVars.EmergencyShuttleEnabled, SetEmergencyShuttleEnabled);
{
if (component.MapEntity != null || component.Entity != null)
{
- _sawmill.Warning("Attempted to re-add an existing centcomm map.");
+ Log.Warning("Attempted to re-add an existing centcomm map.");
return;
}
if (string.IsNullOrEmpty(component.Map.ToString()))
{
- _sawmill.Warning("No CentComm map found, skipping setup.");
+ Log.Warning("No CentComm map found, skipping setup.");
return;
}
if (shuttle == null)
{
- _sawmill.Error($"Unable to spawn emergency shuttle {shuttlePath} for {ToPrettyString(uid)}");
+ Log.Error($"Unable to spawn emergency shuttle {shuttlePath} for {ToPrettyString(uid)}");
return;
}
-using System.Linq;
+using System.Linq;
using Content.Server.GameTicking;
using Content.Server.StationEvents.Components;
using Content.Shared.CCVar;
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] public readonly GameTicker GameTicker = default!;
- private ISawmill _sawmill = default!;
-
public bool EventsEnabled { get; private set; }
private void SetEnabled(bool value) => EventsEnabled = value;
{
base.Initialize();
- _sawmill = Logger.GetSawmill("events");
-
Subs.CVar(_configurationManager, CCVars.EventsEnabled, SetEnabled, true);
}
if (randomEvent == null)
{
var errStr = Loc.GetString("station-event-system-run-random-event-no-valid-events");
- _sawmill.Error(errStr);
+ Log.Error(errStr);
return errStr;
}
var ent = GameTicker.AddGameRule(randomEvent);
var str = Loc.GetString("station-event-system-run-event",("eventName", ToPrettyString(ent)));
- _sawmill.Info(str);
+ Log.Info(str);
return str;
}
public string? PickRandomEvent()
{
var availableEvents = AvailableEvents();
- _sawmill.Info($"Picking from {availableEvents.Count} total available events");
+ Log.Info($"Picking from {availableEvents.Count} total available events");
return FindEvent(availableEvents);
}
{
if (availableEvents.Count == 0)
{
- _sawmill.Warning("No events were available to run!");
+ Log.Warning("No events were available to run!");
return null;
}
}
}
- _sawmill.Error("Event was not found after weighted pick process!");
+ Log.Error("Event was not found after weighted pick process!");
return null;
}
{
if (CanRun(proto, stationEvent, playerCount, currentTime))
{
- _sawmill.Debug($"Adding event {proto.ID} to possibilities");
+ Log.Debug($"Adding event {proto.ID} to possibilities");
result.Add(proto, stationEvent);
}
}
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly AdvertiseSystem _advertise = default!;
- private ISawmill _sawmill = default!;
-
public override void Initialize()
{
base.Initialize();
- _sawmill = Logger.GetSawmill("vending");
SubscribeLocalEvent<VendingMachineComponent, MapInitEvent>(OnComponentMapInit);
SubscribeLocalEvent<VendingMachineComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<VendingMachineComponent, BreakageEventArgs>(OnBreak);
{
if (!PrototypeManager.TryIndex<EntityPrototype>(entry.ID, out var proto))
{
- _sawmill.Error($"Unable to find entity prototype {entry.ID} on {ToPrettyString(uid)} vending.");
+ Log.Error($"Unable to find entity prototype {entry.ID} on {ToPrettyString(uid)} vending.");
continue;
}
if (!TryComp<VendingMachineRestockComponent>(args.Args.Used, out var restockComponent))
{
- _sawmill.Error($"{ToPrettyString(args.Args.User)} tried to restock {ToPrettyString(uid)} with {ToPrettyString(args.Args.Used.Value)} which did not have a VendingMachineRestockComponent.");
+ Log.Error($"{ToPrettyString(args.Args.User)} tried to restock {ToPrettyString(uid)} with {ToPrettyString(args.Args.Used.Value)} which did not have a VendingMachineRestockComponent.");
return;
}
[Dependency] protected readonly SharedPopupSystem Popup = default!;
[Dependency] private readonly IRobustRandom _random = default!;
- private ISawmill _sawmill = default!;
-
public override void Initialize()
{
base.Initialize();
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)
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)
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;
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);
{
// 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")}.");
[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";
SubscribeLocalEvent<DeviceLinkSinkComponent, ComponentStartup>(OnSinkStartup);
SubscribeLocalEvent<DeviceLinkSourceComponent, ComponentRemove>(OnSourceRemoved);
SubscribeLocalEvent<DeviceLinkSinkComponent, ComponentRemove>(OnSinkRemoved);
- _sawmill = Logger.GetSawmill("devicelink");
}
#region Link Validation
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);
}
}
[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);
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}");
}
}