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

@ -82,7 +82,7 @@ public partial class Timer
if (World.WorldState is WorldState.Saving)
{
logger.Error(
"Attempted to start timer {Timer} ({HashCode}) while world is {State}\n{StackTrace}",
$"Attempted to start timer {{Timer}} ({{HashCode}}) while world is {{State}}{Environment.NewLine}{{StackTrace}}",
GetType(),
GetHashCode(),
World.WorldState,
@ -94,7 +94,7 @@ public partial class Timer
if (Thread.CurrentThread != Core.Thread)
{
logger.Error(
"Attempted to start timer {Timer} ({HashCode}) from an invalid thread!\n{StackTrace}",
$"Attempted to start timer {{Timer}} ({{HashCode}}) from an invalid thread!{Environment.NewLine}{{StackTrace}}",
GetType(),
GetHashCode(),
new StackTrace()
@ -126,7 +126,7 @@ public partial class Timer
if (World.WorldState is WorldState.Saving)
{
logger.Error(
"Attempted to stop timer {Timer} ({HashCode}) while world is {State}\n{StackTrace}",
$"Attempted to stop timer {{Timer}} ({{HashCode}}) while world is {{State}}{Environment.NewLine}{{StackTrace}}",
GetType(),
GetHashCode(),
World.WorldState,
@ -138,7 +138,7 @@ public partial class Timer
if (Thread.CurrentThread != Core.Thread)
{
logger.Error(
"Attempted to stop timer {Timer} ({HashCode}) from an invalid thread!\n{StackTrace}",
$"Attempted to stop timer {{Timer}} ({{HashCode}}) from an invalid thread!{Environment.NewLine}{{StackTrace}}",
GetType(),
GetHashCode(),
new StackTrace()
@ -231,7 +231,11 @@ public partial class Timer
{
if (Running)
{
logger.Error("{Timer} detached while still running!\n{StackTrace}", this, new StackTrace());
logger.Error(
$"{{Timer}} detached while still running!{Environment.NewLine}{{StackTrace}}",
this,
new StackTrace()
);
return;
}