Merge pull request #295 from astubenbord/bugfix/app-log-incorrectly-parsed

Bugfix: App log incorrectly parsed
This commit is contained in:
Anton Stubenbord
2023-11-01 19:30:04 +01:00
committed by GitHub
@@ -1,5 +1,4 @@
import 'dart:io'; import 'dart:io';
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
final _newLine = Platform.lineTerminator; final _newLine = Platform.lineTerminator;
@@ -46,12 +45,15 @@ class ParsedErrorLogMessage {
String errorText = ""; String errorText = "";
int currentLine = int currentLine =
1; // Skip first because we know that the first line is ---BEGIN ERROR--- 1; // Skip first because we know that the first line is ---BEGIN ERROR---
while (!_errorEndPattern.hasMatch(log[currentLine])) { while (!_errorEndPattern.hasMatch(log[currentLine])) {
errorText += log[currentLine] + _newLine; errorText += log[currentLine] + _newLine;
currentLine++; currentLine++;
} }
currentLine++; currentLine++;
if (log.length == currentLine) {
return (currentLine, ParsedErrorLogMessage(error: errorText));
}
final hasStackTrace = _stackTraceBeginPattern.hasMatch(log[currentLine]); final hasStackTrace = _stackTraceBeginPattern.hasMatch(log[currentLine]);
String? stackTrace; String? stackTrace;
if (hasStackTrace) { if (hasStackTrace) {