ThreadLog: more obvious prefix!

This commit is contained in:
mischa 2024-01-29 23:54:42 +01:00
parent dd7337c84f
commit 1f123b783c

View File

@ -87,20 +87,23 @@ static void OnLateUpdate()
{
switch (entry.type)
{
// add [Thread#] prefix to make it super obvious where this log message comes from.
// some projects may see unexpected messages that were previously hidden,
// since Unity wouldn't log them without ThreadLog.cs.
case LogType.Log:
Debug.Log($"[T{entry.threadId}] {entry.message}\n{entry.stackTrace}");
Debug.Log($"[Thread{entry.threadId}] {entry.message}\n{entry.stackTrace}");
break;
case LogType.Warning:
Debug.LogWarning($"[T{entry.threadId}] {entry.message}\n{entry.stackTrace}");
Debug.LogWarning($"[TThread{entry.threadId}] {entry.message}\n{entry.stackTrace}");
break;
case LogType.Error:
Debug.LogError($"[T{entry.threadId}] {entry.message}\n{entry.stackTrace}");
Debug.LogError($"[TThread{entry.threadId}] {entry.message}\n{entry.stackTrace}");
break;
case LogType.Exception:
Debug.LogError($"[T{entry.threadId}] {entry.message}\n{entry.stackTrace}");
Debug.LogError($"[TThread{entry.threadId}] {entry.message}\n{entry.stackTrace}");
break;
case LogType.Assert:
Debug.LogAssertion($"[T{entry.threadId}] {entry.message}\n{entry.stackTrace}");
Debug.LogAssertion($"[TThread{entry.threadId}] {entry.message}\n{entry.stackTrace}");
break;
}
}