Seperate logger helper class

This commit is contained in:
Bepis committed 2018-02-23 11:51:02 +11:00
1 parent f684c1004e
commit 15d9b066ae
8 files changed
+29 -20

No files matched your search

+1
View File
@@ -70,6 +70,7 @@
<Compile Include="ConsoleUtil\SafeConsole.cs" />
<Compile Include="Chainloader.cs" />
<Compile Include="BaseUnityPlugin.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="..\BepInEx.Common\BepInEx.Common.projitems" Label="Shared" />
-12
View File
@@ -18,18 +18,6 @@ namespace BepInEx
public static GameObject ManagerObject { get; protected set; } = new GameObject("BepInEx_Manager");
public delegate void EntryLoggedEventHandler(string entry, bool show = false);
public static event EntryLoggedEventHandler EntryLogged;
public static void Log(string entry, bool show = false)
{
EntryLogged?.Invoke(entry, show);
}
public static void Initialize()
{
if (loaded)
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BepInEx
{
public static class BepInLogger
{
public delegate void EntryLoggedEventHandler(string entry, bool show = false);
public static event EntryLoggedEventHandler EntryLogged;
public static void Log(string entry, bool show = false)
{
EntryLogged?.Invoke(entry, show);
}
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ namespace DeveloperConsole
public DeveloperConsole()
{
Chainloader.EntryLogged += (log, show) =>
BepInLogger.EntryLogged += (log, show) =>
{
string current = $"{TotalLog}\r\n{log}";
if (current.Length > 2000)
@@ -103,7 +103,7 @@ namespace DynamicTranslationLoader
if (UnityEngine.Input.GetKeyDown(UnityEngine.KeyCode.F10))
{
Dump();
Chainloader.Log($"Text dumped to \"{Path.GetFullPath("dumped-tl.txt")}\"", true);
BepInLogger.Log($"Text dumped to \"{Path.GetFullPath("dumped-tl.txt")}\"", true);
}
}
#endregion
@@ -31,7 +31,7 @@ namespace ResourceRedirector
if (File.Exists(path))
{
Chainloader.Log($"Loading {path}");
BepInLogger.Log($"Loading {path}");
result = new AssetBundleLoadAssetOperationSimulation(AssetLoader.LoadAudioClip(path, AudioType.WAV));
@@ -55,7 +55,7 @@ namespace ResourceRedirector
if (!File.Exists(path))
return __result;
Chainloader.Log($"Loading emulated asset {path}");
BepInLogger.Log($"Loading emulated asset {path}");
return new AssetBundleLoadAssetOperationSimulation(AssetLoader.LoadTexture(path));
}
@@ -66,7 +66,7 @@ namespace ResourceRedirector
if (!File.Exists(path))
return __result;
Chainloader.Log($"Loading emulated asset {path}");
BepInLogger.Log($"Loading emulated asset {path}");
return new AssetBundleLoadAssetOperationSimulation(AssetLoader.LoadAudioClip(path, AudioType.WAV));
}
@@ -77,7 +77,7 @@ namespace ResourceRedirector
if (!File.Exists(path))
return __result;
Chainloader.Log($"Loading emulated asset {path}");
BepInLogger.Log($"Loading emulated asset {path}");
return new AssetBundleLoadAssetOperationSimulation(AssetLoader.LoadTextAsset(path));
}
+2 -2
View File
@@ -49,7 +49,7 @@ namespace Screencap
while (!File.Exists(filename))
yield return new WaitForSeconds(0.01f);
Chainloader.Log($"Screenshot saved to {filename}", true);
BepInLogger.Log($"Screenshot saved to {filename}", true);
}
void TakeCharScreenshot(string filename)
@@ -59,7 +59,7 @@ namespace Screencap
File.WriteAllBytes(filename, tex.EncodeToPNG());
Destroy(tex);
Illusion.Game.Utils.Sound.Play(SystemSE.photo);
Chainloader.Log($"Character screenshot saved to {filename}", true);
BepInLogger.Log($"Character screenshot saved to {filename}", true);
}
Texture2D RenderCamera(Camera cam)