fix: Updates more logging to Serilog (#1105)

Adds more serilog logging and cleans up some server files.
This commit is contained in:
Kamron Batman 2022-07-01 11:57:08 -07:00 committed by GitHub
parent 1cf4a43c2c
commit 38686c09b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 2261 additions and 2234 deletions

View file

@ -687,9 +687,9 @@ namespace Server
if (!Stackable && m_Amount > 1)
{
Console.WriteLine(
"Warning: 0x{0:X}: Amount changed for non-stackable item '{2}'. ({1})",
Serial.Value,
logger.Warning(
"{Serial}: Amount changed for non-stackable item '{Name}'. ({Amount})",
Serial,
m_Amount,
GetType().Name
);
@ -3164,27 +3164,29 @@ namespace Server
if (item == this)
{
Console.WriteLine(
"Warning: Adding item to itself: [0x{0} {1}].AddItem( [0x{2} {3}] )",
var customException = new InvalidOperationException("Adding item to itself");
logger.Warning(
customException,
"Adding item to itself: ({Serial1} {Item1}).AddItem({Serial2} {Item2})",
Serial,
GetType().Name,
item.Serial,
item.GetType().Name
);
Console.WriteLine(new StackTrace());
return;
}
if (IsChildOf(item))
{
Console.WriteLine(
"Warning: Adding parent item to child: [0x{0} {1}].AddItem( [0x{2} {3}] )",
var customException = new InvalidOperationException("Adding parent item to child");
logger.Warning(
customException,
"Adding parent item to child: [{Serial1} {Item1}].AddItem( [{Serial2} {Item2}] )",
Serial,
GetType().Name,
item.Serial,
item.GetType().Name
);
Console.WriteLine(new StackTrace());
return;
}
@ -3270,9 +3272,10 @@ namespace Server
if (m_DeltaQueue.Count > 0)
{
Utility.PushColor(ConsoleColor.DarkYellow);
Console.WriteLine("Warning: {0} items left in delta queue after processing.", m_DeltaQueue.Count);
Utility.PopColor();
logger.Warning(
"{Count} items left in delta queue after processing.",
m_DeltaQueue.Count
);
}
}