Added logging

This commit is contained in:
M66B 2022-12-21 08:30:01 +01:00
parent e9dce3b4d2
commit efb79062c3
1 changed files with 11 additions and 5 deletions

View File

@ -643,6 +643,10 @@ public class FragmentOAuth extends FragmentBase {
List<String> usernames = new ArrayList<>(); List<String> usernames = new ArrayList<>();
usernames.add(sharedname == null ? username : sharedname); usernames.add(sharedname == null ? username : sharedname);
EntityLog.log(context, "OAuth id=" + id + " user=" + username + " shared=" + sharedname);
EntityLog.log(context, "OAuth token=" + token);
EntityLog.log(context, "OAuth jwt=" + jwt);
if (token != null && sharedname == null && !"gmail".equals(id)) { if (token != null && sharedname == null && !"gmail".equals(id)) {
// https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens // https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens
String[] segments = token.split("\\."); String[] segments = token.split("\\.");
@ -796,13 +800,13 @@ public class FragmentOAuth extends FragmentBase {
if (pop && recent && "gmail".equals(id)) if (pop && recent && "gmail".equals(id))
username = "recent:" + username; username = "recent:" + username;
Log.i("OAuth username=" + username + " shared=" + sharedname); EntityLog.log(context, "OAuth username=" + username + " shared=" + sharedname);
for (Pair<String, String> identity : identities) for (Pair<String, String> identity : identities)
Log.i("OAuth identity=" + identity.first + "/" + identity.second); EntityLog.log(context, "OAuth identity=" + identity.first + "/" + identity.second);
List<EntityFolder> folders; List<EntityFolder> folders;
Log.i("OAuth checking IMAP/POP3 provider=" + provider.id); EntityLog.log(context, "OAuth checking IMAP/POP3 provider=" + provider.id);
try (EmailService aservice = new EmailService( try (EmailService aservice = new EmailService(
context, aprotocol, null, aencryption, false, false, context, aprotocol, null, aencryption, false, false,
EmailService.PURPOSE_CHECK, true)) { EmailService.PURPOSE_CHECK, true)) {
@ -820,7 +824,7 @@ public class FragmentOAuth extends FragmentBase {
Long max_size = null; Long max_size = null;
if (!inbound_only) { if (!inbound_only) {
Log.i("OAuth checking SMTP provider=" + provider.id); EntityLog.log(context, "OAuth checking SMTP provider=" + provider.id);
try (EmailService iservice = new EmailService( try (EmailService iservice = new EmailService(
context, iprotocol, null, iencryption, false, false, context, iprotocol, null, iencryption, false, false,
@ -834,7 +838,7 @@ public class FragmentOAuth extends FragmentBase {
} }
} }
Log.i("OAuth passed provider=" + provider.id); EntityLog.log(context, "OAuth passed provider=" + provider.id);
EntityAccount update = null; EntityAccount update = null;
int protocol = (pop ? EntityAccount.TYPE_POP : EntityAccount.TYPE_IMAP); int protocol = (pop ? EntityAccount.TYPE_POP : EntityAccount.TYPE_IMAP);
@ -952,6 +956,8 @@ public class FragmentOAuth extends FragmentBase {
db.endTransaction(); db.endTransaction();
} }
EntityLog.log(context, "OAuth done");
ServiceSynchronize.eval(context, "OAuth"); ServiceSynchronize.eval(context, "OAuth");
args.putBoolean("updated", update != null); args.putBoolean("updated", update != null);