mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-01 03:32:38 +00:00
make debug log hook a setting
This commit is contained in:
parent
cb00fafa1c
commit
1885ab201d
@ -66,16 +66,19 @@ namespace QSB
|
||||
|
||||
DebugSettings = Helper.Storage.Load<DebugSettings>("debugsettings.json") ?? new DebugSettings();
|
||||
|
||||
Application.logMessageReceived += (condition, stackTrace, logType) =>
|
||||
DebugLog.DebugWrite($"[Debug] {condition} {stackTrace}", logType switch
|
||||
{
|
||||
LogType.Error => MessageType.Error,
|
||||
LogType.Assert => MessageType.Error,
|
||||
LogType.Warning => MessageType.Warning,
|
||||
LogType.Log => MessageType.Message,
|
||||
LogType.Exception => MessageType.Error,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(logType), logType, null)
|
||||
});
|
||||
if (DebugSettings.HookDebugLogs)
|
||||
{
|
||||
Application.logMessageReceived += (condition, stackTrace, logType) =>
|
||||
DebugLog.DebugWrite($"[Debug] {condition} {stackTrace}", logType switch
|
||||
{
|
||||
LogType.Error => MessageType.Error,
|
||||
LogType.Assert => MessageType.Error,
|
||||
LogType.Warning => MessageType.Warning,
|
||||
LogType.Log => MessageType.Message,
|
||||
LogType.Exception => MessageType.Error,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(logType), logType, null)
|
||||
});
|
||||
}
|
||||
|
||||
InitializeAssemblies();
|
||||
|
||||
|
@ -13,6 +13,9 @@ namespace QSB.Utility
|
||||
[JsonProperty("playerIdInLogs")]
|
||||
public bool PlayerIdInLogs;
|
||||
|
||||
[JsonProperty("hookDebugLogs")]
|
||||
public bool HookDebugLogs;
|
||||
|
||||
[JsonProperty("debugMode")]
|
||||
public bool DebugMode;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
"useKcpTransport": false,
|
||||
"dumpWorldObjects": false,
|
||||
"playerIdInLogs": false,
|
||||
"hookDebugLogs": false,
|
||||
"debugMode": false,
|
||||
"drawGui": false,
|
||||
"drawLines": false,
|
||||
|
Loading…
Reference in New Issue
Block a user