fix: Update log consumption

This commit is contained in:
Anton Stubenbord
2023-11-01 19:27:49 +01:00
parent 72c23d0386
commit 394171968d

View File

@@ -1,5 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'dart:developer' as dev;
import 'package:logger/logger.dart'; import 'package:logger/logger.dart';
final _newLine = Platform.lineTerminator; final _newLine = Platform.lineTerminator;
@@ -50,8 +50,13 @@ class ParsedErrorLogMessage {
while (!_errorEndPattern.hasMatch(log[currentLine])) { while (!_errorEndPattern.hasMatch(log[currentLine])) {
errorText += log[currentLine] + _newLine; errorText += log[currentLine] + _newLine;
currentLine++; currentLine++;
assert(currentLine < log.length, "Error log message is not closed");
} }
currentLine++; currentLine++;
// dev.log("Parsing ${currentLine}/${log.length}");
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) {