go-imap icon indicating copy to clipboard operation
go-imap copied to clipboard

Debugging idea: log progress of a data transfer

Open andlabs opened this issue 9 years ago • 0 comments

It would be useful for debugging to have the built-in debug log display the progress of a data literal send over time, assuming this is even possible. Perhaps only in an imap.Wait() call?

Example, when doing a UID FETCH something BODY[] with imap.LogAll enabled, instead of:

[imap] 13:20:20 S:  BODY[] {2120811}
[imap] 13:20:20 S: literal 111 bytes
[imap] 13:20:37 S: literal 2048 bytes
[imap] 13:21:34 S: literal 2048 bytes
[imap] 13:21:34 S: literal 2048 bytes
[imap] 13:21:34 S: literal 496 bytes
[imap] 13:21:34 S: literal 2048 bytes
[imap] 13:21:34 S: literal 2048 bytes

it would say something like

[imap] 13:20:20 S:  BODY[] {2120811}
[imap] 13:20:20 S: literal 111 bytes (111/2120811 bytes received)
[imap] 13:20:37 S: literal 2048 bytes (2159/2120811 bytes received)
[imap] 13:21:34 S: literal 2048 bytes (4207/2120811 bytes received)
[imap] 13:21:34 S: literal 2048 bytes (6255/2120811 bytes received)
[imap] 13:21:34 S: literal 496 bytes (6751/2120811 bytes received)
[imap] 13:21:34 S: literal 2048 bytes (8799/2120811 bytes received)
[imap] 13:21:34 S: literal 2048 bytes (10847/2120811 bytes received)

Is this possible? I'm not familiar enough with either IMAP or the package's source to tell myself. Thanks!

andlabs avatar Apr 05 '16 17:04 andlabs