|
@@ -3,6 +3,7 @@ using BepInEx.Logging;
|
|
|
using System.Diagnostics;
|
|
|
using System.IO;
|
|
|
using System.Reflection;
|
|
|
+using System.Text;
|
|
|
using BepInEx.Bootstrap;
|
|
|
using BepInEx.Preloader.Core.Logging;
|
|
|
using BepInEx.Unity.Logging;
|
|
@@ -49,10 +50,11 @@ namespace BepInEx.Unity.Bootstrap
|
|
|
|
|
|
protected override void InitializeLoggers()
|
|
|
{
|
|
|
- Logger.Listeners.Add(new UnityLogListener());
|
|
|
-
|
|
|
base.InitializeLoggers();
|
|
|
|
|
|
+ // Write to Unity logs directly only if console is not present (or user explicitly wants to)
|
|
|
+ if (ConfigWriteToUnityLog.Value || !ConsoleManager.ConsoleActive)
|
|
|
+ Logger.Listeners.Add(new UnityLogListener());
|
|
|
|
|
|
if (Utility.CurrentPlatform != Platform.Windows)
|
|
|
{
|
|
@@ -83,6 +85,14 @@ namespace BepInEx.Unity.Bootstrap
|
|
|
true,
|
|
|
"Enables showing unity log messages in the BepInEx logging system.");
|
|
|
|
|
|
+ private static readonly ConfigEntry<bool> ConfigWriteToUnityLog = ConfigFile.CoreConfig.Bind(
|
|
|
+ "Logging", "WriteToUnityLog",
|
|
|
+ false,
|
|
|
+ new StringBuilder()
|
|
|
+ .AppendLine("Enables writing log messages to Unity's log system")
|
|
|
+ .AppendLine("NOTE: By default, Unity already writes BepInEx console output to Unity logs")
|
|
|
+ .Append("Use this setting only if no BepInEx log messages are present in Unity's output_log").ToString());
|
|
|
+
|
|
|
private static readonly ConfigEntry<bool> ConfigDiskWriteUnityLog = ConfigFile.CoreConfig.Bind(
|
|
|
"Logging.Disk", "WriteUnityLog",
|
|
|
false,
|