Commit 425e7e3
committed
MtProtoKit: bound decoded-object log lines, honour MTLogSetEnabled
A tester's log came back 44 MB across 21 rotated files covering only 6.6
hours — the previous log covered 21 hours in the same budget. 31.3 MB of it,
71% of everything collected, was two lines:
[MTRequestMessageService#... response for <id> is <whole decoded object>]
[MTProto#...@... [N] received <whole decoded object> (...)]
`%@` on a parsed rpc result prints the object in full. Sticker-set responses
alone accounted for 14.6 MB across 113 lines — 129 KB per line, one of them
458,653 characters. Rotation is by file count against a fixed per-file size,
so the payloads were evicting the diagnostics they were meant to sit beside.
MTLogTruncatedDescription caps a description at 1024 characters and appends
the true length, expanding the cut to whole character sequences so it cannot
land inside a surrogate pair. Replaying the same log through the cap leaves
13.1 MB of 42 MB — the same rotation budget now holds roughly 3.2x the span.
Separately, MTLog/MTLogWithPrefix/MTShortLog tested only whether a logging
function was installed. NetworkRegisterLoggingFunction installs those once
and never removes them; MTLogSetEnabled only flips MTLogEnabledValue, which
MTLogEnabled() consults but the log functions themselves did not. Turning
logging off therefore silenced only the call sites wrapped in an explicit
MTLogEnabled() check, and MTProto's outgoing short-message line was building
its description and logging unconditionally. Both are fixed.
Co-authored-by: D3C0Y <decoder-dev@users.noreply.github.com>1 parent d8aace5 commit 425e7e3
4 files changed
Lines changed: 28 additions & 7 deletions
File tree
- submodules/MtProtoKit
- PublicHeaders/MtProtoKit
- Sources
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
11 | 22 | | |
12 | 23 | | |
13 | 24 | | |
14 | | - | |
| 25 | + | |
15 | 26 | | |
16 | 27 | | |
17 | 28 | | |
| |||
21 | 32 | | |
22 | 33 | | |
23 | 34 | | |
24 | | - | |
| 35 | + | |
25 | 36 | | |
26 | 37 | | |
27 | 38 | | |
| |||
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
40 | | - | |
| 51 | + | |
41 | 52 | | |
42 | 53 | | |
43 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
880 | 880 | | |
881 | 881 | | |
882 | 882 | | |
883 | | - | |
| 883 | + | |
884 | 884 | | |
885 | 885 | | |
886 | 886 | | |
| |||
1106 | 1106 | | |
1107 | 1107 | | |
1108 | 1108 | | |
1109 | | - | |
1110 | | - | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
1111 | 1113 | | |
1112 | 1114 | | |
1113 | 1115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
825 | | - | |
| 825 | + | |
826 | 826 | | |
827 | 827 | | |
828 | 828 | | |
| |||
0 commit comments