diff --git a/Components/MineSharp.Protocol/MinecraftClient.cs b/Components/MineSharp.Protocol/MinecraftClient.cs index 1bff8bd5..4a069c23 100644 --- a/Components/MineSharp.Protocol/MinecraftClient.cs +++ b/Components/MineSharp.Protocol/MinecraftClient.cs @@ -236,7 +236,7 @@ public async Task Connect(GameState nextState) return true; } - Logger.Debug($"Connecting to {ip}:{Port}."); + Logger.Debug($"Connecting to {ip}:{Port} with PVN={Data.Version.Protocol}"); try { diff --git a/MineSharp.Bot.IntegrationTests/Program.cs b/MineSharp.Bot.IntegrationTests/Program.cs index de6ec334..85610c9d 100644 --- a/MineSharp.Bot.IntegrationTests/Program.cs +++ b/MineSharp.Bot.IntegrationTests/Program.cs @@ -1,4 +1,7 @@ using MineSharp.Bot.IntegrationTests.Tests; +using MineSharp.Bot.Utils; + +LoggingHelper.EnableDebugLogs(true); await PlayerTests.RunAll(); await WindowTests.RunAll(); diff --git a/MineSharp.Bot/NLog.config b/MineSharp.Bot/NLog.config index e19029f8..d9c584ac 100644 --- a/MineSharp.Bot/NLog.config +++ b/MineSharp.Bot/NLog.config @@ -4,7 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - + diff --git a/MineSharp.Bot/Utils/LoggingHelper.cs b/MineSharp.Bot/Utils/LoggingHelper.cs index 56eebb48..5b953a03 100644 --- a/MineSharp.Bot/Utils/LoggingHelper.cs +++ b/MineSharp.Bot/Utils/LoggingHelper.cs @@ -13,11 +13,13 @@ public static void EnableDebugLogs(bool trace = false) { var configuration = new NLog.Config.LoggingConfiguration(); - var logfile = new NLog.Targets.FileTarget("customfile") { FileName = $"{DateTime.Now:dd.MM.yyyy hh:mm:ss}.log" }; + var logfile = new NLog.Targets.FileTarget("customfile") { FileName = $"logs/{DateTime.Now:dd.MM.yyyy hh:mm:ss}.log" }; + var latestlog = new NLog.Targets.FileTarget("latestfile") { FileName = "logs/latest.log", DeleteOldFileOnStartup = true }; var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); var level = trace ? LogLevel.Trace : LogLevel.Debug; configuration.AddRule(level, LogLevel.Fatal, logfile); + configuration.AddRule(level, LogLevel.Fatal, latestlog); configuration.AddRule(LogLevel.Debug, LogLevel.Fatal, logconsole); LogManager.Configuration = configuration;