ReadConsole: lock Debug.Log classification to Log; avoid bit-based fallback when stacktrace shows Debug:Log
- Detect explicit Debug.Log in stacktrace (UnityEngine.Debug:Log) - Do not downgrade/upgrade to Warning via mode bits for editor-originated logs - Keeps informational setup lines (e.g., MCP registration, bridge start) as Logmain
parent
a40db48132
commit
dc6171dfe6
|
|
@ -267,7 +267,8 @@ namespace UnityMcpBridge.Editor.Tools
|
|||
// --- Filtering ---
|
||||
// Prefer classifying severity from message/stacktrace; fallback to mode bits if needed
|
||||
LogType unityType = InferTypeFromMessage(message);
|
||||
if (unityType == LogType.Log)
|
||||
bool isExplicitDebugLog = IsExplicitDebugLog(message);
|
||||
if (!isExplicitDebugLog && unityType == LogType.Log)
|
||||
{
|
||||
unityType = GetLogTypeFromMode(mode);
|
||||
}
|
||||
|
|
@ -422,6 +423,8 @@ namespace UnityMcpBridge.Editor.Tools
|
|||
return LogType.Error;
|
||||
if (fullMessage.IndexOf("LogWarning", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
return LogType.Warning;
|
||||
if (IsExplicitDebugLog(fullMessage))
|
||||
return LogType.Log;
|
||||
|
||||
// Exceptions often include the word "Exception" in the first lines
|
||||
if (fullMessage.IndexOf("Exception", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
|
|
@ -434,6 +437,15 @@ namespace UnityMcpBridge.Editor.Tools
|
|||
return LogType.Log;
|
||||
}
|
||||
|
||||
private static bool IsExplicitDebugLog(string fullMessage)
|
||||
{
|
||||
// Detect explicit Debug.Log in the stacktrace/message to lock type to Log
|
||||
if (string.IsNullOrEmpty(fullMessage)) return false;
|
||||
if (fullMessage.IndexOf("Debug:Log (", StringComparison.OrdinalIgnoreCase) >= 0) return true;
|
||||
if (fullMessage.IndexOf("UnityEngine.Debug:Log (", StringComparison.OrdinalIgnoreCase) >= 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the "one level lower" remapping for filtering, like the old version.
|
||||
/// This ensures compatibility with the filtering logic that expects remapped types.
|
||||
|
|
|
|||
Loading…
Reference in New Issue