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

@@ -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}.");
$"{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}.");
$"{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;
}