Skip to content

Commit ced9ecc

Browse files
committed
feat(log): widen the dump budget to fit a debug session
New(zh-Hant): 診斷回報上限放寬,可附上更完整的日誌 New(en-US): the diagnostics report now carries a much longer log tail
1 parent 40ea62d commit ced9ecc

5 files changed

Lines changed: 11 additions & 8 deletions

File tree

lib/core/diagnostics/debug_dump.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ library;
77
/// a chat window will show without collapsing. The diagnostics are the part
88
/// that cannot be trimmed (every row answers a question somebody asks), so the
99
/// log takes whatever is left.
10-
const int dumpLimit = 4000;
10+
const int dumpLimit = 39995;
1111

1212
const String _diagnosticsHeading = '=== 除錯資訊 ===';
1313
const String _logHeading = '=== 日誌紀錄 ===';

lib/core/diagnostics/haste_api.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import 'package:dpip/core/diagnostics/dump_uploader.dart';
77
/// Posts a dump and returns the URL to read it at.
88
///
99
/// A paste rather than an attachment because of where these end up: a bug
10-
/// report in Discord or an issue, where 4000 characters of log pasted inline
11-
/// buries everything around it and an attached file is not read at all.
10+
/// report in Discord or an issue, where tens of thousands of characters of log
11+
/// pasted inline buries everything around it and an attached file is not read
12+
/// at all.
1213
class HasteApi implements DumpUploader {
1314
const HasteApi(this._client);
1415

lib/shared/diagnostics/dump_action.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ import 'package:talker_flutter/talker_flutter.dart';
2222
///
2323
/// The two halves answer different questions and a report needs both: the
2424
/// diagnostics say what this build and this device are, the log says what they
25-
/// just did. Pasting 4000 characters into a chat buries the conversation they
26-
/// are part of, so they go to a paste and only the link comes back.
25+
/// just did. Pasting tens of thousands of characters into a chat buries the
26+
/// conversation they are part of, so they go to a paste and only the link
27+
/// comes back.
2728
///
2829
/// Returns true when a link was produced. Failures are reported to the user
2930
/// here and logged; the caller only has to stop showing its spinner.

test/core/diagnostics/debug_dump_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ void main() {
5454
test('diagnostics are never cut to make room', () {
5555
// A partial diagnostic reads as a complete one and is answered as if it
5656
// were, which is worse than carrying no log at all.
57-
final big = 'Version: 26w34b\n${'x' * 5000}';
57+
// Sized past the limit so the log must be dropped for the diagnostics to fit.
58+
final big = 'Version: 26w34b\n${'x' * (dumpLimit + 1000)}';
5859
final out = buildDump(diagnostics: big, logLines: lines(50));
5960
expect(out, contains('Version: 26w34b'));
60-
expect(out, contains('x' * 5000));
61+
expect(out, contains('x' * (dumpLimit + 1000)));
6162
expect(out, isNot(contains('line 0')));
6263
});
6364

test/core/logging/log_benign_assert_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/// into the log that sheet belongs to — a debug assert from talker_flutter,
33
/// which paints that sheet as a coloured box with bare `ListTile`s inside it.
44
/// Nothing this app can fix, and nothing a user is affected by, but it filled
5-
/// the terminal, the log page and the 4000-character dump budget.
5+
/// the terminal, the log page and the dump budget.
66
///
77
/// The tests here pin the two halves of the compromise: it is said once, so it
88
/// is on the record, and it is said only once, so it cannot flood. A real error

0 commit comments

Comments
 (0)