From bed1b853193f9d4e2a1f974609feffa1c53f9f6c Mon Sep 17 00:00:00 2001 From: Clansty Date: Fri, 29 Nov 2024 11:57:58 +0800 Subject: [PATCH] [+] LogUnity --- AquaMai/AquaMai.Mods/Utils/LogUnity.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 AquaMai/AquaMai.Mods/Utils/LogUnity.cs diff --git a/AquaMai/AquaMai.Mods/Utils/LogUnity.cs b/AquaMai/AquaMai.Mods/Utils/LogUnity.cs new file mode 100644 index 00000000..3826feba --- /dev/null +++ b/AquaMai/AquaMai.Mods/Utils/LogUnity.cs @@ -0,0 +1,23 @@ +using AquaMai.Config.Attributes; +using MelonLoader; +using UnityEngine; + +namespace AquaMai.Mods.Utils; + +[ConfigSection( + en: "Output Unity logs (for debugging purposes)", + zh: "输出 Unity 日志(调试用)", + exampleHidden: true)] +public static class LogUnity +{ + public static void OnBeforePatch() + { + Application.logMessageReceived += Log; + } + + private static void Log(string msg, string stackTrace, LogType type) + { + MelonLogger.Msg("[Unity] " + msg); + MelonLogger.Msg("[Unity] " + stackTrace); + } +} \ No newline at end of file