diff --git a/NitroxModel/Logger/Log.cs b/NitroxModel/Logger/Log.cs index 96295e2185..38ba8c418b 100644 --- a/NitroxModel/Logger/Log.cs +++ b/NitroxModel/Logger/Log.cs @@ -23,7 +23,7 @@ public static string PlayerName set => SetPlayerName(value); } - public static void Setup(bool asyncConsoleWriter = false, InGameLogger inGameLogger = null) + public static void Setup(bool asyncConsoleWriter = false, InGameLogger inGameLogger = null, bool isConsoleApp = false) { if (logger != null) { @@ -33,7 +33,12 @@ public static void Setup(bool asyncConsoleWriter = false, InGameLogger inGameLog .MinimumLevel.Debug() .WriteTo.Logger(cnf => { - string consoleTemplate = "{Timestamp:HH:mm:ss.fff} {Message}{NewLine}{Exception}"; + string consoleTemplate = isConsoleApp switch + { + false => $"[{{Timestamp:HH:mm:ss.fff}}] [{GetLoggerName()}{{{nameof(PlayerName)}}}][{{Level:u3}}] {{Message}}{{NewLine}}{{Exception}}", + _ => "[{Timestamp:HH:mm:ss.fff}] {Message}{NewLine}{Exception}" + }; + if (asyncConsoleWriter) { cnf.WriteTo.Async(a => a.ColoredConsole(outputTemplate: consoleTemplate)); diff --git a/NitroxServer-Subnautica/Program.cs b/NitroxServer-Subnautica/Program.cs index f478e276c1..55de33b5ab 100644 --- a/NitroxServer-Subnautica/Program.cs +++ b/NitroxServer-Subnautica/Program.cs @@ -32,7 +32,7 @@ public class Program private static async Task Main(string[] args) { // The thread that writers to console is paused while selecting text in console. So console writer needs to be async. - Log.Setup(asyncConsoleWriter: true); + Log.Setup(asyncConsoleWriter: true, isConsoleApp: true); AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; ConfigureCultureInfo();