fix: Makes logging more consistent (#1246)

This commit is contained in:
Kamron Batman 2022-11-13 00:36:23 -08:00 committed by GitHub
parent 8e0d01d4be
commit d8cfb6b935
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 90 additions and 69 deletions

View file

@ -407,7 +407,11 @@ public sealed class Map : IComparable<Map>, ISpanFormattable, ISpanParsable<Map>
{
if (this == Internal && m_Name != "Internal")
{
logger.Warning("Internal map name was '{Name}'\n{StackTrace}", m_Name, new StackTrace());
logger.Warning(
$"Internal map name was '{{Name}}'{Environment.NewLine}{{StackTrace}}",
m_Name,
new StackTrace()
);
m_Name = "Internal";
}
@ -417,7 +421,11 @@ public sealed class Map : IComparable<Map>, ISpanFormattable, ISpanParsable<Map>
{
if (this == Internal && value != "Internal")
{
logger.Warning("Attempted to set internal map name to '{Value}'\n{StackTrace}", value, new StackTrace());
logger.Warning(
$"Attempted to set internal map name to '{{Value}}'{Environment.NewLine}{{StackTrace}}",
value,
new StackTrace()
);
value = "Internal";
}

View file

@ -80,18 +80,19 @@ public static class MapLoader
if (failures.Count > 0)
{
logger.Warning(
"Map Definitions loaded with failures ({Count} maps, {FailureCount} failures) ({Duration:F2} seconds)",
$"Loading map definitions {{Status}} ({{Count}} maps, {{FailureCount}} failures) ({{Duration:F2}} seconds){Environment.NewLine}{{Failures}}",
"failed",
count,
failures.Count,
stopwatch.Elapsed.TotalSeconds
stopwatch.Elapsed.TotalSeconds,
failures
);
logger.Warning("Map load failures: {Failure}", failures);
}
else
{
logger.Information(
"Map Definitions loaded successfully ({Count} maps, {FailureCount} failures) ({Duration:F2} seconds)",
"Loading map definitions {Status} ({Count} maps, {FailureCount} failures) ({Duration:F2} seconds)",
"done",
count,
failures.Count,
stopwatch.Elapsed.TotalSeconds