@@ -267,8 +267,8 @@ bool includeStacktrace
267267 // --- Filtering ---
268268 // Prefer classifying severity from message/stacktrace; fallback to mode bits if needed
269269 LogType unityType = InferTypeFromMessage ( message ) ;
270- bool isExplicitDebugLog = IsExplicitDebugLog ( message ) ;
271- if ( ! isExplicitDebugLog && unityType == LogType . Log )
270+ bool isExplicitDebug = IsExplicitDebugLog ( message ) ;
271+ if ( ! isExplicitDebug && unityType == LogType . Log )
272272 {
273273 unityType = GetLogTypeFromMode ( mode ) ;
274274 }
@@ -423,10 +423,16 @@ private static LogType InferTypeFromMessage(string fullMessage)
423423 return LogType . Error ;
424424 if ( fullMessage . IndexOf ( "LogWarning" , StringComparison . OrdinalIgnoreCase ) >= 0 )
425425 return LogType . Warning ;
426- if ( IsExplicitDebugLog ( fullMessage ) )
427- return LogType . Log ;
428426
429- // Exceptions often include the word "Exception" in the first lines
427+ // Compiler diagnostics (C#): "warning CSxxxx" / "error CSxxxx"
428+ if ( fullMessage . IndexOf ( " warning CS" , StringComparison . OrdinalIgnoreCase ) >= 0
429+ || fullMessage . IndexOf ( ": warning CS" , StringComparison . OrdinalIgnoreCase ) >= 0 )
430+ return LogType . Warning ;
431+ if ( fullMessage . IndexOf ( " error CS" , StringComparison . OrdinalIgnoreCase ) >= 0
432+ || fullMessage . IndexOf ( ": error CS" , StringComparison . OrdinalIgnoreCase ) >= 0 )
433+ return LogType . Error ;
434+
435+ // Exceptions (avoid misclassifying compiler diagnostics)
430436 if ( fullMessage . IndexOf ( "Exception" , StringComparison . OrdinalIgnoreCase ) >= 0 )
431437 return LogType . Exception ;
432438
@@ -439,7 +445,6 @@ private static LogType InferTypeFromMessage(string fullMessage)
439445
440446 private static bool IsExplicitDebugLog ( string fullMessage )
441447 {
442- // Detect explicit Debug.Log in the stacktrace/message to lock type to Log
443448 if ( string . IsNullOrEmpty ( fullMessage ) ) return false ;
444449 if ( fullMessage . IndexOf ( "Debug:Log (" , StringComparison . OrdinalIgnoreCase ) >= 0 ) return true ;
445450 if ( fullMessage . IndexOf ( "UnityEngine.Debug:Log (" , StringComparison . OrdinalIgnoreCase ) >= 0 ) return true ;
0 commit comments