diff --git a/Obsidian/Client.cs b/Obsidian/Client.cs index 511b9d80d..3029d0689 100644 --- a/Obsidian/Client.cs +++ b/Obsidian/Client.cs @@ -340,7 +340,7 @@ public async Task StartConnectionAsync() } } - Logger.LogInformation($"Disconnected client"); + Logger.LogInformation("Disconnected client"); if (State == ClientState.Play) { @@ -603,7 +603,7 @@ internal async Task HandleKeepAliveAsync(KeepAlivePacket keepAlive) { if (!missedKeepAlives.Contains(keepAlive.KeepAliveId)) { - Logger.LogWarning($"Received invalid KeepAlive from {Player.Username}?? Naughty???? ({Player.Uuid})"); + Logger.LogWarning("Received invalid KeepAlive from {Username}?? Naughty???? ({Uuid})", Player?.Username, Player?.Uuid); await DisconnectAsync(ChatMessage.Simple("Kicked for invalid KeepAlive.")); return; } @@ -614,7 +614,7 @@ internal async Task HandleKeepAliveAsync(KeepAlivePacket keepAlive) ping = Math.Max(0, ping); // negative ping is impossible. this.ping = (int)ping; - Logger.LogDebug($"Valid KeepAlive ({keepAlive.KeepAliveId}) handled from {Player.Username} ({Player.Uuid})"); + Logger.LogDebug("Valid KeepAlive ({KeepAliveId}) handled from {Username} ({Uuid})", keepAlive.KeepAliveId, Player?.Username, Player?.Uuid); // KeepAlive is handled. missedKeepAlives.Remove(keepAlive.KeepAliveId); } diff --git a/Obsidian/Net/MinecraftStream.Reading.cs b/Obsidian/Net/MinecraftStream.Reading.cs index 2862e0d84..132f39c0e 100644 --- a/Obsidian/Net/MinecraftStream.Reading.cs +++ b/Obsidian/Net/MinecraftStream.Reading.cs @@ -622,7 +622,7 @@ public ItemStack ReadItemStack() { var enchantments = (NbtList)child; - //Globals.PacketLogger.LogDebug($"List Type: {enchantments.ListType}"); + //Globals.PacketLogger.LogDebug("List Type: {ListType}", enchantments.ListType); foreach (var enchantment in enchantments) { @@ -651,7 +651,7 @@ public ItemStack ReadItemStack() var intTag = (NbtTag)child; itemMetaBuilder.WithDurability(intTag.Value); - //Globals.PacketLogger.LogDebug($"Setting damage: {tag.IntValue}"); + //Globals.PacketLogger.LogDebug("Setting damage: {IntValue}", tag.IntValue); break; } @@ -733,7 +733,7 @@ public async Task ReadSlotAsync() { var enchantments = (NbtList)child; - //Globals.PacketLogger.LogDebug($"List Type: {enchantments.ListType}"); + //Globals.PacketLogger.LogDebug("List Type: {ListType}", enchantments.ListType); foreach (var enchantment in enchantments) { @@ -761,7 +761,7 @@ public async Task ReadSlotAsync() var intTag = (NbtTag)child; itemMetaBuilder.WithDurability(intTag.Value); - //Globals.PacketLogger.LogDebug($"Setting damage: {tag.IntValue}"); + //Globals.PacketLogger.LogDebug("Setting damage: {IntValue}", tag.IntValue); break; } case "display": diff --git a/Obsidian/Net/MinecraftStream.cs b/Obsidian/Net/MinecraftStream.cs index 49535eb2e..87608c329 100644 --- a/Obsidian/Net/MinecraftStream.cs +++ b/Obsidian/Net/MinecraftStream.cs @@ -65,7 +65,7 @@ public async Task DumpAsync(bool clear = true, IPacket packet = null) if (clear) await ClearDebug(); - //Globals.PacketLogger.LogDebug($"Dumped stream to {filePath}"); + //Globals.PacketLogger.LogDebug("Dumped stream to {FilePath}", filePath); } // unused @@ -83,7 +83,7 @@ public async Task DumpAsync(bool clear = true, string name = "") if (clear) await ClearDebug(); - //Globals.PacketLogger.LogDebug($"Dumped stream to {filePath}"); + //Globals.PacketLogger.LogDebug("Dumped stream to {FilePath}", filePath); } public Task ClearDebug() diff --git a/Obsidian/Plugins/PluginProviders/RemotePluginProvider.cs b/Obsidian/Plugins/PluginProviders/RemotePluginProvider.cs index 7f0f2e28c..728b67097 100644 --- a/Obsidian/Plugins/PluginProviders/RemotePluginProvider.cs +++ b/Obsidian/Plugins/PluginProviders/RemotePluginProvider.cs @@ -122,7 +122,7 @@ private PluginContainer CompilePluginFiles((string owner, string name) repositor if (diagnostic.Severity != DiagnosticSeverity.Error || diagnostic.IsWarningAsError) continue; - logger.LogError($"Compilation failed: {diagnostic.Location} {diagnostic.GetMessage()}"); + logger.LogError("Compilation failed: {Location} {Message}", diagnostic.Location, diagnostic.GetMessage()); } } diff --git a/Obsidian/Plugins/PluginProviders/UncompiledPluginProvider.cs b/Obsidian/Plugins/PluginProviders/UncompiledPluginProvider.cs index 8f1ca11ef..3fad2bd2e 100644 --- a/Obsidian/Plugins/PluginProviders/UncompiledPluginProvider.cs +++ b/Obsidian/Plugins/PluginProviders/UncompiledPluginProvider.cs @@ -48,7 +48,7 @@ public PluginContainer GetPlugin(string path, ILogger logger) } catch { - logger.LogError($"Reloading '{Path.GetFileName(path)}' failed, file is not accessible."); + logger.LogError("Reloading '{Path}' failed, file is not accessible.", Path.GetFileName(path)); return new PluginContainer(new PluginInfo(name), name); } SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(SourceText.From(fileStream)); @@ -69,7 +69,7 @@ public PluginContainer GetPlugin(string path, ILogger logger) if (diagnostic.Severity != DiagnosticSeverity.Error || diagnostic.IsWarningAsError) continue; - logger.LogError($"Compilation failed: {diagnostic.Location} {diagnostic.GetMessage()}"); + logger.LogError("Compilation failed: {Location} {Message}", diagnostic.Location, diagnostic.GetMessage()); } } diff --git a/Obsidian/Server.cs b/Obsidian/Server.cs index 271cc7801..e3b277ac6 100644 --- a/Obsidian/Server.cs +++ b/Obsidian/Server.cs @@ -253,7 +253,7 @@ public async Task RunAsync() await this.userCache.LoadAsync(this._cancelTokenSource.Token); - _logger.LogInformation($"Loading properties..."); + _logger.LogInformation("Loading properties..."); await (Operators as OperatorList).InitializeAsync(); @@ -267,7 +267,7 @@ public async Task RunAsync() await Task.WhenAll(Configuration.DownloadPlugins.Select(path => PluginManager.LoadPluginAsync(path))); if (!Configuration.OnlineMode) - _logger.LogInformation($"Starting in offline mode..."); + _logger.LogInformation("Starting in offline mode..."); CommandsRegistry.Register(this); diff --git a/Obsidian/WorldData/World.cs b/Obsidian/WorldData/World.cs index 780809338..7086b33d0 100644 --- a/Obsidian/WorldData/World.cs +++ b/Obsidian/WorldData/World.cs @@ -457,7 +457,7 @@ public async Task LoadAsync(DimensionCodec codec) if (levelCompound.TryGetTag("Version", out var tag)) LevelData.VersionData = tag as NbtCompound; - Logger.LogInformation($"Loading spawn chunks into memory..."); + Logger.LogInformation("Loading spawn chunks into memory..."); for (int rx = -1; rx < 1; rx++) for (int rz = -1; rz < 1; rz++) LoadRegion(rx, rz);