// A debug entry is received private void ReceivedLog(string logString, string stackTrace, LogType logType) { #if UNITY_EDITOR if (isQuittingApplication) { return; } #endif // Truncate the log if it is longer than maxLogLength int logLength = logString.Length; if (stackTrace == null) { if (logLength > maxLogLength) { logString = logString.Substring(0, maxLogLength - 11) + "<truncated>"; } } else { logLength += stackTrace.Length; if (logLength > maxLogLength) { // Decide which log component(s) to truncate int halfMaxLogLength = maxLogLength / 2; if (logString.Length >= halfMaxLogLength) { if (stackTrace.Length >= halfMaxLogLength) { // Truncate both logString and stackTrace logString = logString.Substring(0, halfMaxLogLength - 11) + "<truncated>"; // If stackTrace doesn't end with a blank line, its last line won't be visible in the console for some reason stackTrace = stackTrace.Substring(0, halfMaxLogLength - 12) + "<truncated>\n"; } else { // Truncate logString logString = logString.Substring(0, maxLogLength - stackTrace.Length - 11) + "<truncated>"; } } else { // Truncate stackTrace stackTrace = stackTrace.Substring(0, maxLogLength - logString.Length - 12) + "<truncated>\n"; } } } QueuedDebugLogEntry queuedLogEntry = new QueuedDebugLogEntry(logString, stackTrace, logType); lock ( logEntriesLock ) { queuedLogEntries.Add(queuedLogEntry); } }
// A debug entry is received private void ReceivedLog(string logString, string stackTrace, LogType logType) { #if UNITY_EDITOR if (isQuittingApplication) { return; } #endif QueuedDebugLogEntry queuedLogEntry = new QueuedDebugLogEntry(logString, stackTrace, logType); lock ( logEntriesLock ) { queuedLogEntries.Add(queuedLogEntry); } }