fix: Fixes structured logging (#1043)
- [X] Fixes various bugs in logging.
This commit is contained in:
parent
78bb4f4bb2
commit
6e69d25e33
31 changed files with 96 additions and 102 deletions
|
|
@ -320,8 +320,7 @@ public sealed class Map : IComparable<Map>
|
|||
public const int SectorShift = 4;
|
||||
public const int SectorActiveRange = 2;
|
||||
|
||||
private static ILogger _logger;
|
||||
private static ILogger Logger => _logger ??= LogFactory.GetLogger(typeof(Map));
|
||||
private static ILogger logger = LogFactory.GetLogger(typeof(Map));
|
||||
|
||||
private readonly int m_FileIndex;
|
||||
private readonly Sector[][] m_Sectors;
|
||||
|
|
@ -409,7 +408,7 @@ public sealed class Map : IComparable<Map>
|
|||
{
|
||||
if (this == Internal && m_Name != "Internal")
|
||||
{
|
||||
Logger.Warning($"Internal map name was '{m_Name}'\n{new StackTrace()}");
|
||||
logger.Warning("Internal map name was '{Name}'\n{StackTrace}", m_Name, new StackTrace());
|
||||
m_Name = "Internal";
|
||||
}
|
||||
|
||||
|
|
@ -419,8 +418,7 @@ public sealed class Map : IComparable<Map>
|
|||
{
|
||||
if (this == Internal && value != "Internal")
|
||||
{
|
||||
Logger.Warning($"Attempted to set internal map name to '{value}'\n{new StackTrace()}");
|
||||
|
||||
logger.Warning("Attempted to set internal map name to '{Value}'\n{StackTrace}", value, new StackTrace());
|
||||
value = "Internal";
|
||||
}
|
||||
|
||||
|
|
@ -1045,7 +1043,7 @@ public sealed class Map : IComparable<Map>
|
|||
|
||||
if (Regions.ContainsKey(regName))
|
||||
{
|
||||
Logger.Warning($"Duplicate region name '{regName}' for map '{Name}'");
|
||||
logger.Warning("Duplicate region name '{RegionName}' for map '{MapName}'", regName, Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1101,7 +1099,7 @@ public sealed class Map : IComparable<Map>
|
|||
}
|
||||
else
|
||||
{
|
||||
Logger.Warning($"Warning: Invalid object ({o}) in line of sight");
|
||||
logger.Warning("Warning: Invalid object ({Object}) in line of sight", o);
|
||||
p = Point3D.Zero;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,18 +80,18 @@ namespace Server
|
|||
if (failures.Count > 0)
|
||||
{
|
||||
logger.Warning(
|
||||
"Map Definitions loaded with failures ({0} maps, {1} failures) ({2:F2} seconds)",
|
||||
"Map Definitions loaded with failures ({Count} maps, {FailureCount} failures) ({Duration:F2} seconds)",
|
||||
count,
|
||||
failures.Count,
|
||||
stopwatch.Elapsed.TotalSeconds
|
||||
);
|
||||
|
||||
logger.Warning(string.Join(Environment.NewLine, failures));
|
||||
logger.Warning("Map load failures: {Failure}", failures);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Information(
|
||||
"Map Definitions loaded successfully ({0} maps, {1} failures) ({2:F2} seconds)",
|
||||
"Map Definitions loaded successfully ({Count} maps, {FailureCount} failures) ({Duration:F2} seconds)",
|
||||
count,
|
||||
failures.Count,
|
||||
stopwatch.Elapsed.TotalSeconds
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue