Add more pretty strings to logs (#5768)

This commit is contained in:
Leon Friedrich
2021-12-14 00:22:58 +13:00
committed by GitHub
parent fa1de1a75a
commit 7f81f0b8b8
41 changed files with 98 additions and 91 deletions

View File

@@ -209,6 +209,9 @@ namespace Content.Server.Chemistry.Components
// Create a pop-up for the user
popupSys.PopupEntity(Loc.GetString("injector-component-injecting-user"), target, Filter.Entities(user));
if (!EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
return false;
// Get entity for logging. Log with EntityUids when?
var logSys = EntitySystem.Get<AdminLogSystem>();
@@ -238,7 +241,7 @@ namespace Content.Server.Chemistry.Components
if (ToggleState == InjectorToggleMode.Inject)
{
logSys.Add(LogType.ForceFeed,
$"{_entities.ToPrettyString(user)} is attempting to inject a solution into {_entities.ToPrettyString(target)}");
$"{_entities.ToPrettyString(user):user} is attempting to inject {_entities.ToPrettyString(target):target} with a solution {SolutionContainerSystem.ToPrettyString(solution):solution}");
// TODO solution pretty string.
}
}
@@ -249,7 +252,7 @@ namespace Content.Server.Chemistry.Components
if (ToggleState == InjectorToggleMode.Inject)
logSys.Add(LogType.Ingestion,
$"{_entities.ToPrettyString(user)} is attempting to inject themselves with a solution.");
$"{_entities.ToPrettyString(user):user} is attempting to inject themselves with a solution {SolutionContainerSystem.ToPrettyString(solution):solution}.");
//TODO solution pretty string.
}

View File

@@ -18,7 +18,7 @@ namespace Content.Server.Chemistry.EntitySystems
var coordinates = Transform(Owner).Coordinates;
_logSystem.Add(LogType.ChemicalReaction, reaction.Impact,
$"Chemical reaction {reaction.ID} occurred with strength {unitReactions:strength} on entity {ToPrettyString(Owner)} at {coordinates}");
$"Chemical reaction {reaction.ID:reaction} occurred with strength {unitReactions:strength} on entity {ToPrettyString(Owner):metabolizer} at {coordinates}");
SoundSystem.Play(Filter.Pvs(Owner, entityManager:EntityManager), reaction.Sound.GetSound(), Owner);
}

View File

@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Database;
@@ -134,7 +134,7 @@ namespace Content.Server.Chemistry.EntitySystems
public static string ToPrettyString(Solution solution)
{
var sb = new StringBuilder();
sb.Append("Solution content: [");
sb.Append("[");
var first = true;
foreach (var (id, quantity) in solution.Contents)
{