-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.cs
More file actions
37 lines (31 loc) · 1 KB
/
Copy pathPlugin.cs
File metadata and controls
37 lines (31 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;
namespace NoDebugLog;
[BepInPlugin(Guid, Name, Version)]
public class Plugin : BaseUnityPlugin
{
private const string Guid = "com.enchart.nodebuglog";
private const string Name = "NoDebugLog";
private const string Version = "1.0.0.0";
private readonly ConfigEntry<bool> _configDisableLogging;
public Plugin()
{
_configDisableLogging = Config.Bind("General", "DisableLogging", true, "Disables Unity logger.");
_configDisableLogging.SettingChanged += (_, _) => LogEnabled = _configDisableLogging.Value;
}
private bool LogEnabled
{
set
{
Debug.unityLogger.logEnabled = !value;
if (value)
Logger.LogWarning($"Unity logger has been disabled! To enable it, edit the configuration of {Name}");
}
}
private void Awake()
{
Logger.LogInfo($"Plugin {Guid} is loaded!");
LogEnabled = _configDisableLogging.Value;
}
}