fix: Fixes structured logging (#1043)

- [X] Fixes various bugs in logging.
This commit is contained in:
Kamron Batman 2022-06-05 01:00:22 -07:00 committed by GitHub
parent 78bb4f4bb2
commit 6e69d25e33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 96 additions and 102 deletions

View file

@ -284,11 +284,11 @@ namespace Server
watch.Stop();
logger.Information(string.Format("World loaded ({1} items, {2} mobiles) ({0:F2} seconds)",
logger.Information("World loaded ({ItemCount} items, {MobileCount} mobiles) ({Duration:F2} seconds)",
watch.Elapsed.TotalSeconds,
Items.Count,
Mobiles.Count
));
);
WorldState = WorldState.Running;
}
@ -304,7 +304,7 @@ namespace Server
{
if (_pendingAdd.ContainsKey(entity.Serial))
{
logger.Warning("Entity {0} was both pending both deletion and addition after save", entity);
logger.Warning("Entity {Entity} was both pending both deletion and addition after save", entity);
}
RemoveEntity(entity);
@ -402,7 +402,7 @@ namespace Server
watch.Stop();
logger.Information("Writing world save snapshot done ({0:F2} seconds)", watch.Elapsed.TotalSeconds);
logger.Information("Writing world save snapshot done ({Duration:F2} seconds)", watch.Elapsed.TotalSeconds);
}
catch (Exception ex)
{
@ -505,7 +505,7 @@ namespace Server
if (exception == null)
{
var duration = watch.Elapsed.TotalSeconds;
logger.Information("World save completed ({0:F2} seconds)", duration);
logger.Information("World save completed ({Duration:F2} seconds)", duration);
// Only broadcast if it took at least 150ms
if (duration >= 0.15)