mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00:00
Truncate Log lines (#4003)
This commit is contained in:
parent
15bfceb05a
commit
e1eae00b35
1 changed files with 11 additions and 1 deletions
|
@ -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<String> messageLines = message.split("\n");
|
||||
if (messageLines.length < maxLines) {
|
||||
return message;
|
||||
}
|
||||
return "${messageLines.sublist(0, maxLines).join("\n")} ...";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue