Fix a bunch of logger warnings (#17691)

This commit is contained in:
metalgearsloth
2023-06-27 23:56:52 +10:00
committed by GitHub
parent 4d1ab16ed8
commit 90110183be
31 changed files with 56 additions and 49 deletions

View File

@@ -60,7 +60,7 @@ namespace Content.Server.Access.Systems
if (!_prototypeManager.TryIndex(id.JobName, out JobPrototype? job))
{
Logger.ErrorS("access", $"Invalid job id ({id.JobName}) for preset card");
Log.Error($"Invalid job id ({id.JobName}) for preset card");
return;
}

View File

@@ -130,13 +130,13 @@ namespace Content.Server.Administration.Systems
if (!match.Success)
{
// TODO: Ideally, CVar validation during setting should be better integrated
Logger.Warning("Webhook URL does not appear to be valid. Using anyways...");
Log.Warning("Webhook URL does not appear to be valid. Using anyways...");
return;
}
if (match.Groups.Count <= 2)
{
Logger.Error("Could not get webhook ID or token.");
Log.Error("Could not get webhook ID or token.");
return;
}

View File

@@ -71,7 +71,7 @@ namespace Content.Server.AirlockPainter
if (!_prototypeManager.TryIndex<AirlockGroupPrototype>(airlock.Group, out var grp))
{
Logger.Error("Group not defined: %s", airlock.Group);
Log.Error("Group not defined: %s", airlock.Group);
return;
}

View File

@@ -54,10 +54,10 @@ public sealed class ProjectileAnomalySystem : EntitySystem
priority.Add(entity);
}
Logger.Debug($"shots: {projectileCount}");
Log.Debug($"shots: {projectileCount}");
while (projectileCount > 0)
{
Logger.Debug($"{projectileCount}");
Log.Debug($"{projectileCount}");
var target = priority.Any()
? _random.PickAndTake(priority)
: _random.Pick(inRange);

View File

@@ -20,7 +20,7 @@ public sealed class MutationSystem : EntitySystem
{
if (!seed.Unique)
{
Logger.Error($"Attempted to mutate a shared seed");
Log.Error($"Attempted to mutate a shared seed");
return;
}

View File

@@ -80,7 +80,7 @@ public sealed class ChunkingSystem : EntitySystem
{
if (!xformQuery.TryGetComponent(viewerUid, out var xform))
{
Logger.Error($"Player has deleted viewer entities? Viewers: {string.Join(", ", viewers.Select(x => ToPrettyString(x)))}");
Log.Error($"Player has deleted viewer entities? Viewers: {string.Join(", ", viewers.Select(x => ToPrettyString(x)))}");
continue;
}

View File

@@ -127,7 +127,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (ev.EntityTarget is not { Valid: true } entityTarget)
{
Logger.Error($"Attempted to perform an entity-targeted action without a target! Action: {entityAction.DisplayName}");
Log.Error($"Attempted to perform an entity-targeted action without a target! Action: {entityAction.DisplayName}");
return;
}
@@ -138,11 +138,15 @@ public abstract class SharedActionsSystem : EntitySystem
return;
if (act.Provider == null)
{
_adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action targeted at {ToPrettyString(entityTarget):target}.");
}
else
{
_adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action (provided by {ToPrettyString(act.Provider.Value):provider}) targeted at {ToPrettyString(entityTarget):target}.");
}
if (entityAction.Event != null)
{
@@ -156,7 +160,7 @@ public abstract class SharedActionsSystem : EntitySystem
if (ev.EntityCoordinatesTarget is not { } entityCoordinatesTarget)
{
Logger.Error($"Attempted to perform a world-targeted action without a target! Action: {worldAction.DisplayName}");
Log.Error($"Attempted to perform a world-targeted action without a target! Action: {worldAction.DisplayName}");
return;
}
@@ -166,11 +170,15 @@ public abstract class SharedActionsSystem : EntitySystem
return;
if (act.Provider == null)
{
_adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action targeted at {entityCoordinatesTarget:target}.");
}
else
{
_adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action (provided by {ToPrettyString(act.Provider.Value):provider}) targeted at {entityCoordinatesTarget:target}.");
}
if (worldAction.Event != null)
{
@@ -186,11 +194,15 @@ public abstract class SharedActionsSystem : EntitySystem
return;
if (act.Provider == null)
{
_adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action.");
}
else
{
_adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action provided by {ToPrettyString(act.Provider.Value):provider}.");
}
performEvent = instantAction.Event;
break;
@@ -325,7 +337,7 @@ public abstract class SharedActionsSystem : EntitySystem
// Because action classes have state data, e.g. cooldowns and uses-remaining, people should not be adding prototypes directly
if (action is IPrototype)
{
Logger.Error("Attempted to directly add a prototype action. You need to clone a prototype in order to use it.");
Log.Error("Attempted to directly add a prototype action. You need to clone a prototype in order to use it.");
return;
}

View File

@@ -42,7 +42,7 @@ public abstract class AlertsSystem : EntitySystem
return alertsComponent.Alerts.ContainsKey(alert.AlertKey);
}
Logger.DebugS("alert", "unknown alert type {0}", alertType);
Log.Debug("Unknown alert type {0}", alertType);
return false;
}
@@ -101,7 +101,7 @@ public abstract class AlertsSystem : EntitySystem
}
else
{
Logger.ErrorS("alert", "Unable to show alert {0}, please ensure this alertType has" +
Log.Error("Unable to show alert {0}, please ensure this alertType has" +
" a corresponding YML alert prototype",
alertType);
}
@@ -147,7 +147,7 @@ public abstract class AlertsSystem : EntitySystem
}
else
{
Logger.ErrorS("alert", "unable to clear alert, unknown alertType {0}", alertType);
Log.Error("Unable to clear alert, unknown alertType {0}", alertType);
}
}
@@ -206,8 +206,7 @@ public abstract class AlertsSystem : EntitySystem
{
if (!_typeToAlert.TryAdd(alert.AlertType, alert))
{
Logger.ErrorS("alert",
"Found alert with duplicate alertType {0} - all alerts must have" +
Log.Error("Found alert with duplicate alertType {0} - all alerts must have" +
" a unique alerttype, this one will be skipped", alert.AlertType);
}
}
@@ -230,7 +229,7 @@ public abstract class AlertsSystem : EntitySystem
if (!IsShowingAlert(player.Value, msg.Type))
{
Logger.DebugS("alert", "user {0} attempted to" +
Log.Debug("User {0} attempted to" +
" click alert {1} which is not currently showing for them",
EntityManager.GetComponent<MetaDataComponent>(player.Value).EntityName, msg.Type);
return;
@@ -238,7 +237,7 @@ public abstract class AlertsSystem : EntitySystem
if (!TryGet(msg.Type, out var alert))
{
Logger.WarningS("alert", "unrecognized encoded alert {0}", msg.Type);
Log.Warning("Unrecognized encoded alert {0}", msg.Type);
return;
}

View File

@@ -234,7 +234,7 @@ public abstract partial class SharedBuckleSystem
if (!buckled.Buckled || buckled.LastEntityBuckledTo != uid)
{
Logger.Error($"A moving strap entity {ToPrettyString(uid)} attempted to re-parent an entity that does not 'belong' to it {ToPrettyString(buckledEntity)}");
Log.Error($"A moving strap entity {ToPrettyString(uid)} attempted to re-parent an entity that does not 'belong' to it {ToPrettyString(buckledEntity)}");
continue;
}

View File

@@ -26,7 +26,6 @@ public sealed class ToggleableClothingSystem : EntitySystem
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly SharedStrippableSystem _strippable = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly INetManager _net = default!;
private Queue<EntityUid> _toInsert = new();

View File

@@ -17,7 +17,7 @@ public sealed class ContainerFillSystem : EntitySystem
{
if (!TryComp(uid, out ContainerManagerComponent? containerComp))
{
Logger.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} has no {nameof(ContainerManagerComponent)}.");
Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} has no {nameof(ContainerManagerComponent)}.");
return;
}
@@ -28,7 +28,7 @@ public sealed class ContainerFillSystem : EntitySystem
{
if (!_containerSystem.TryGetContainer(uid, contaienrId, out var container, containerComp))
{
Logger.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} is missing a container ({contaienrId}).");
Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} is missing a container ({contaienrId}).");
continue;
}
@@ -37,7 +37,7 @@ public sealed class ContainerFillSystem : EntitySystem
var ent = Spawn(proto, coords);
if (!container.Insert(ent, EntityManager, null, xform))
{
Logger.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}.");
Log.Error($"Entity {ToPrettyString(uid)} with a {nameof(ContainerFillComponent)} failed to insert an entity: {ToPrettyString(ent)}.");
Transform(ent).AttachToGridOrMap();
break;
}

View File

@@ -153,7 +153,7 @@ namespace Content.Shared.Damage
if (damage == null)
{
Logger.Error("Null DamageSpecifier. Probably because a required yaml field was not given.");
Log.Error("Null DamageSpecifier. Probably because a required yaml field was not given.");
return null;
}

View File

@@ -33,7 +33,8 @@ public abstract class SharedDiceSystem : EntitySystem
private void OnUseInHand(EntityUid uid, DiceComponent component, UseInHandEvent args)
{
if (args.Handled) return;
if (args.Handled)
return;
args.Handled = true;
Roll(uid, component);
@@ -58,7 +59,7 @@ public abstract class SharedDiceSystem : EntitySystem
if (side < 1 || side > die.Sides)
{
Logger.Error($"Attempted to set die {ToPrettyString(uid)} to an invalid side ({side}).");
Log.Error($"Attempted to set die {ToPrettyString(uid)} to an invalid side ({side}).");
return;
}
@@ -74,7 +75,7 @@ public abstract class SharedDiceSystem : EntitySystem
if (value % die.Multiplier != 0 || value/ die.Multiplier + die.Offset < 1)
{
Logger.Error($"Attempted to set die {ToPrettyString(uid)} to an invalid value ({value}).");
Log.Error($"Attempted to set die {ToPrettyString(uid)} to an invalid value ({value}).");
return;
}

View File

@@ -180,7 +180,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
if (!Resolve(args.User, ref comp))
{
Logger.Error($"Attempting to start a doAfter with invalid user: {ToPrettyString(args.User)}.");
Log.Error($"Attempting to start a doAfter with invalid user: {ToPrettyString(args.User)}.");
id = null;
return false;
}
@@ -317,7 +317,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
if (!comp.DoAfters.TryGetValue(id, out var doAfter))
{
Logger.Error($"Attempted to cancel do after with an invalid id ({id}) on entity {ToPrettyString(entity)}");
Log.Error($"Attempted to cancel do after with an invalid id ({id}) on entity {ToPrettyString(entity)}");
return;
}

View File

@@ -653,7 +653,7 @@ public abstract class SharedDoorSystem : EntitySystem
case DoorState.Welded:
// A welded door? This should never have been active in the first place.
Logger.Error($"Welded door was in the list of active doors. Door: {ToPrettyString(door.Owner)}");
Log.Error($"Welded door was in the list of active doors. Door: {ToPrettyString(door.Owner)}");
break;
}
}

View File

@@ -77,7 +77,7 @@ namespace Content.Shared.Friction
if (!xformQuery.TryGetComponent(uid, out var xform))
{
Logger.ErrorS("physics", $"Unable to get transform for {ToPrettyString(body.Owner)} in tilefrictioncontroller");
Log.Error($"Unable to get transform for {ToPrettyString(body.Owner)} in tilefrictioncontroller");
continue;
}

View File

@@ -164,7 +164,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
if (!hand.Container.Remove(entity, EntityManager))
{
Logger.Error($"Failed to remove {ToPrettyString(entity)} from users hand container when dropping. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
Log.Error($"Failed to remove {ToPrettyString(entity)} from users hand container when dropping. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
return;
}

View File

@@ -219,7 +219,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
if (!handContainer.Insert(entity, EntityManager))
{
Logger.Error($"Failed to insert {ToPrettyString(entity)} into users hand container when picking up. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
Log.Error($"Failed to insert {ToPrettyString(entity)} into users hand container when picking up. User: {ToPrettyString(uid)}. Hand: {hand.Name}.");
return;
}

View File

@@ -21,7 +21,7 @@ namespace Content.Shared.Humanoid
if (!_prototypeManager.TryIndex(species, out SpeciesPrototype? speciesProto))
{
speciesProto = _prototypeManager.Index<SpeciesPrototype>("Human");
Logger.Warning($"Unable to find species {species} for name, falling back to Human");
Log.Warning($"Unable to find species {species} for name, falling back to Human");
}
switch (speciesProto.Naming)

View File

@@ -16,7 +16,6 @@ namespace Content.Shared.Interaction
public sealed class RotateToFaceSystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
/// <summary>

View File

@@ -48,7 +48,7 @@ public partial class InventorySystem : EntitySystem
if (!containerComp.TryGetContainer(slotDefinition.Name, out var container))
{
if (inventory.LifeStage >= ComponentLifeStage.Initialized)
Logger.Error($"Missing inventory container {slot} on entity {ToPrettyString(uid)}");
Log.Error($"Missing inventory container {slot} on entity {ToPrettyString(uid)}");
return false;
}

View File

@@ -10,7 +10,6 @@ namespace Content.Shared.Maps;
/// </summary>
public sealed class TurfSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapMan = default!;
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;

View File

@@ -30,7 +30,7 @@ public abstract partial class SharedMoverController
{
if (uid == relayEntity)
{
Logger.Error($"An entity attempted to relay movement to itself. Entity:{ToPrettyString(uid)}");
Log.Error($"An entity attempted to relay movement to itself. Entity:{ToPrettyString(uid)}");
return;
}

View File

@@ -55,7 +55,7 @@ namespace Content.Shared.Pulling
if (!TryComp<SharedPullerComponent?>(state.Puller.Value, out var comp))
{
Logger.Error($"Pullable state for entity {ToPrettyString(uid)} had invalid puller entity {ToPrettyString(state.Puller.Value)}");
Log.Error($"Pullable state for entity {ToPrettyString(uid)} had invalid puller entity {ToPrettyString(state.Puller.Value)}");
// ensure it disconnects from any different puller, still
ForceDisconnectPullable(component);
return;

View File

@@ -163,7 +163,7 @@ namespace Content.Shared.Pulling
}
else
{
Logger.WarningS("c.go.c.pulling", "Well now you've done it, haven't you? Someone transferred pulling (onto {0}) while presently pulling something that has no Pullable component (on {1})!", pullable.Owner, oldPullable);
Log.Warning("Well now you've done it, haven't you? Someone transferred pulling (onto {0}) while presently pulling something that has no Pullable component (on {1})!", pullable.Owner, oldPullable);
return false;
}
}

View File

@@ -16,7 +16,6 @@ namespace Content.Shared.StatusEffect
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
public override void Initialize()

View File

@@ -30,7 +30,7 @@ public sealed class StepTriggerSystem : EntitySystem
return;
if (!TryComp(uid, out FixturesComponent? fixtures) || fixtures.FixtureCount == 0)
Logger.Warning($"{ToPrettyString(uid)} has an active step trigger without any fixtures.");
Log.Warning($"{ToPrettyString(uid)} has an active step trigger without any fixtures.");
#endif
}

View File

@@ -68,7 +68,7 @@ public sealed class BinSystem : EntitySystem
var ent = Spawn(id, xform.Coordinates);
if (!TryInsertIntoBin(uid, ent, component))
{
Logger.Error($"Entity {ToPrettyString(ent)} was unable to be initialized into bin {ToPrettyString(uid)}");
Log.Error($"Entity {ToPrettyString(ent)} was unable to be initialized into bin {ToPrettyString(uid)}");
return;
}
}

View File

@@ -32,7 +32,6 @@ namespace Content.Shared.Stunnable
[Dependency] private readonly StatusEffectsSystem _statusEffectSystem = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
/// <summary>

View File

@@ -93,7 +93,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
private void OnMapInit(EntityUid uid, MeleeWeaponComponent component, MapInitEvent args)
{
if (component.NextAttack > Timing.CurTime)
Logger.Warning($"Initializing a map that contains an entity that is on cooldown. Entity: {ToPrettyString(uid)}");
Log.Warning($"Initializing a map that contains an entity that is on cooldown. Entity: {ToPrettyString(uid)}");
#endif
}

View File

@@ -98,7 +98,7 @@ public abstract partial class SharedGunSystem : EntitySystem
private void OnMapInit(EntityUid uid, GunComponent component, MapInitEvent args)
{
if (component.NextFire > Timing.CurTime)
Logger.Warning($"Initializing a map that contains an entity that is on cooldown. Entity: {ToPrettyString(uid)}");
Log.Warning($"Initializing a map that contains an entity that is on cooldown. Entity: {ToPrettyString(uid)}");
DebugTools.Assert((component.AvailableModes & component.SelectedMode) != 0x0);
#endif