public static void CaptureLogLineAround(int atLine, string[] allLines, LogLine ll) { // Type is always error for exception ll.type = LogLine.LogType.Error; // Find head/tail, search up until we find double blank line int head = SearchForDoubleNewLine(atLine, allLines, SearchDirection.Up); int tail = SearchForDoubleNewLine(atLine, allLines, SearchDirection.Down); CaptureMethodCommon.FastForwardLineIfThereIsUnityInternalLogLine(ref head, tail, allLines); // Callstack start is line with first " at " keyword. which is this line from Detect int callStackStart = atLine; ll.message = CaptureTextFromToLine(head, callStackStart - 1, allLines); ll.callstack = CaptureTextFromToLine(atLine, tail, allLines); ll.startFromSourceLine = head; ll.endAtSourceLine = tail; }
public static void CaptureLogLineAround(int atLine, string[] allLines, LogLine ll) { string logType = allLines[atLine].Replace(LogKeyword, ""); if (logType.StartsWith("Error")) { ll.type = LogLine.LogType.Error; } else if (logType.StartsWith("Warning")) { ll.type = LogLine.LogType.Warning; } else { ll.type = LogLine.LogType.Log; } // Find head/tail, search up until we find double blank line int head = SearchForDoubleNewLine(atLine, allLines, SearchDirection.Up); int tail = SearchForDoubleNewLine(atLine, allLines, SearchDirection.Down); CaptureMethodCommon.FastForwardLineIfThereIsUnityInternalLogLine(ref head, tail, allLines); int callStackStart = SearchForLineBeginWith(atLine, allLines, CallStackStart, SearchDirection.Up); if (head == callStackStart) { // The "message" ends with an extra \n. Look back for the actual message. head = SearchForDoubleNewLine(callStackStart - 2, allLines, SearchDirection.Up); } // Usually message is just 1 line above Internal_Log ll.message = CaptureTextFromToLine(head, callStackStart - 1, allLines); ll.message = ll.message.Replace('\n', ' '); ll.callstack = CaptureTextFromToLine(callStackStart + 1, tail, allLines); ll.startFromSourceLine = head; ll.endAtSourceLine = tail; }