diff --git a/mobile/lib/shared/views/app_log_page.dart b/mobile/lib/shared/views/app_log_page.dart index 3d1fbfee71..a8dfc6ec44 100644 --- a/mobile/lib/shared/views/app_log_page.dart +++ b/mobile/lib/shared/views/app_log_page.dart @@ -148,7 +148,7 @@ class AppLogPage extends HookConsumerWidget { ), ), TextSpan( - text: logMessage.message, + text: truncateLogMessage(logMessage.message, 4), style: const TextStyle( fontSize: 14.0, ), @@ -170,4 +170,14 @@ class AppLogPage extends HookConsumerWidget { ), ); } + + /// Truncate the log message to a certain number of lines + /// @param int maxLines - Max number of lines to truncate + String truncateLogMessage(String message, int maxLines) { + List messageLines = message.split("\n"); + if (messageLines.length < maxLines) { + return message; + } + return "${messageLines.sublist(0, maxLines).join("\n")} ..."; + } }