소스 검색

Add log recording to the unity log

Bepis 7 년 전
부모
커밋
d99b2d0e66
1개의 변경된 파일14개의 추가작업 그리고 1개의 파일을 삭제
  1. 14 1
      BepInEx/Logger.cs

+ 14 - 1
BepInEx/Logger.cs

@@ -1,4 +1,6 @@
-namespace BepInEx
+using System.Runtime.CompilerServices;
+
+namespace BepInEx
 {
     /// <summary>
     /// A helper class to use for logging.
@@ -24,7 +26,18 @@
         /// <param name="show">Whether or not it should be dislpayed to the user.</param>
         public static void Log(string entry, bool show = false)
         {
+            UnityEngine.UnityLogWriter.WriteStringToUnityLog($"BEPIN - {entry}\r\n");
+
             EntryLogged?.Invoke(entry, show);
         }
     }
 }
+
+namespace UnityEngine
+{
+    internal sealed class UnityLogWriter
+    {
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        public static extern void WriteStringToUnityLog(string s);
+    }
+}