From 394171968d85b46930464490d878df2e1489e7e7 Mon Sep 17 00:00:00 2001 From: Anton Stubenbord Date: Wed, 1 Nov 2023 19:27:49 +0100 Subject: [PATCH 1/2] fix: Update log consumption --- lib/features/logging/models/parsed_log_message.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/features/logging/models/parsed_log_message.dart b/lib/features/logging/models/parsed_log_message.dart index d63a591b..2bf20aba 100644 --- a/lib/features/logging/models/parsed_log_message.dart +++ b/lib/features/logging/models/parsed_log_message.dart @@ -1,5 +1,5 @@ import 'dart:io'; - +import 'dart:developer' as dev; import 'package:logger/logger.dart'; final _newLine = Platform.lineTerminator; @@ -46,12 +46,17 @@ class ParsedErrorLogMessage { String errorText = ""; int currentLine = 1; // Skip first because we know that the first line is ---BEGIN ERROR--- - + while (!_errorEndPattern.hasMatch(log[currentLine])) { errorText += log[currentLine] + _newLine; currentLine++; + assert(currentLine < log.length, "Error log message is not closed"); } currentLine++; + // dev.log("Parsing ${currentLine}/${log.length}"); + if (log.length == currentLine) { + return (currentLine, ParsedErrorLogMessage(error: errorText)); + } final hasStackTrace = _stackTraceBeginPattern.hasMatch(log[currentLine]); String? stackTrace; if (hasStackTrace) { From 6f42ef033cc15caa8d23cd2e0f56cc095c9533b9 Mon Sep 17 00:00:00 2001 From: Anton Stubenbord Date: Wed, 1 Nov 2023 19:29:00 +0100 Subject: [PATCH 2/2] chore: Cleanup code --- lib/features/logging/models/parsed_log_message.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/features/logging/models/parsed_log_message.dart b/lib/features/logging/models/parsed_log_message.dart index 2bf20aba..a4bf9d7d 100644 --- a/lib/features/logging/models/parsed_log_message.dart +++ b/lib/features/logging/models/parsed_log_message.dart @@ -1,5 +1,4 @@ import 'dart:io'; -import 'dart:developer' as dev; import 'package:logger/logger.dart'; final _newLine = Platform.lineTerminator; @@ -50,10 +49,8 @@ class ParsedErrorLogMessage { while (!_errorEndPattern.hasMatch(log[currentLine])) { errorText += log[currentLine] + _newLine; currentLine++; - assert(currentLine < log.length, "Error log message is not closed"); } currentLine++; - // dev.log("Parsing ${currentLine}/${log.length}"); if (log.length == currentLine) { return (currentLine, ParsedErrorLogMessage(error: errorText)); }