From e8ed1053ec8c67b798882962853e0c95cb863828 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Thu, 3 Aug 2023 13:33:21 -0700 Subject: [PATCH] debuglog: Logger uses console to say mod so i gotta do that right --- QSB/Utility/DebugLog.cs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/QSB/Utility/DebugLog.cs b/QSB/Utility/DebugLog.cs index ba6ba294..6f7c88c4 100644 --- a/QSB/Utility/DebugLog.cs +++ b/QSB/Utility/DebugLog.cs @@ -21,26 +21,24 @@ public static class DebugLog message = $"[{ProcessInstanceId}] " + message; } + var @this = QSBCore.Helper != null ? QSBCore.Helper.Console : ModConsole.OwmlConsole; + var Logger = @this.GetValue("Logger"); + var _socket = @this.GetValue("_socket"); // copied from https://github.com/ow-mods/owml/blob/master/src/OWML.Logging/ModSocketOutput.cs#L33 + Logger?.Log($"{type}: {message}"); + + _socket.WriteToSocket(new ModSocketMessage { - var Logger = ModConsole.OwmlConsole.GetValue("Logger"); - var _socket = ModConsole.OwmlConsole.GetValue("_socket"); + SenderName = "QSB", + SenderType = GetCallingType(), + Type = type, + Message = message + }); - Logger?.Log($"{type}: {message}"); - - _socket.WriteToSocket(new ModSocketMessage - { - SenderName = "QSB", - SenderType = GetCallingType(), - Type = type, - Message = message - }); - - if (type == MessageType.Fatal) - { - _socket.Close(); - Process.GetCurrentProcess().Kill(); - } + if (type == MessageType.Fatal) + { + _socket.Close(); + Process.GetCurrentProcess().Kill(); } }