DEV: Log IMAP sync logs to imap_sync.log file (PR #10420)

GitHub

@SamSaffron would you mind taking a quick look at this to see if the implementation is OK? Of course this will not sync to Logster, but it didn’t anyway because it is mostly debug logs, and will greatly help with debugging.