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

@ -17,19 +17,18 @@ using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Server.Json
{
public class MapConverter : JsonConverter<Map>
{
public override Map Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
reader.TokenType switch
{
JsonTokenType.String => Map.Parse(reader.GetString()),
JsonTokenType.Number => Map.Maps[reader.GetInt32()],
_ => throw new JsonException("Value must be a number or string")
};
namespace Server.Json;
public override void Write(Utf8JsonWriter writer, Map value, JsonSerializerOptions options) =>
writer.WriteStringValue(value.Name);
}
}
public class MapConverter : JsonConverter<Map>
{
public override Map Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
reader.TokenType switch
{
JsonTokenType.String => Map.Parse(reader.GetString()),
JsonTokenType.Number => Map.Maps[reader.GetInt32()],
_ => throw new JsonException("Value must be a number or string")
};
public override void Write(Utf8JsonWriter writer, Map value, JsonSerializerOptions options) =>
writer.WriteStringValue(value.Name);
}