Fixing string concat in Timber logging

This commit is contained in:
Philip Whitehouse 2017-03-18 18:15:40 +00:00 committed by Vincent Breitmoser
parent 0b9decdf42
commit f7c4b0e7c4
3 changed files with 14 additions and 16 deletions

View file

@ -523,15 +523,14 @@ class ImapFolderPusher extends ImapFolder {
for (long msgSeqNum : msgSeqs) { for (long msgSeqNum : msgSeqs) {
if (K9MailLib.isDebug()) { if (K9MailLib.isDebug()) {
Timber.v("Comparing EXPUNGEd msgSeq " + msgSeq + " to " + msgSeqNum); Timber.v("Comparing EXPUNGEd msgSeq %d to %d", msgSeq, msgSeqNum);
} }
if (msgSeqNum == msgSeq) { if (msgSeqNum == msgSeq) {
String uid = msgSeqUidMap.get(msgSeqNum); String uid = msgSeqUidMap.get(msgSeqNum);
if (K9MailLib.isDebug()) { if (K9MailLib.isDebug()) {
Timber.d("Scheduling removal of UID " + uid + " because msgSeq " + msgSeqNum + Timber.d("Scheduling removal of UID %s because msgSeq %d was expunged", uid, msgSeqNum);
" was expunged");
} }
removeMsgUids.add(uid); removeMsgUids.add(uid);
@ -540,8 +539,7 @@ class ImapFolderPusher extends ImapFolder {
String uid = msgSeqUidMap.get(msgSeqNum); String uid = msgSeqUidMap.get(msgSeqNum);
if (K9MailLib.isDebug()) { if (K9MailLib.isDebug()) {
Timber.d("Reducing msgSeq for UID " + uid + " from " + msgSeqNum + " to " + Timber.d("Reducing msgSeq for UID %s from %d to %d", uid, msgSeqNum, (msgSeqNum - 1));
(msgSeqNum - 1));
} }
msgSeqUidMap.remove(msgSeqNum); msgSeqUidMap.remove(msgSeqNum);
@ -566,7 +564,7 @@ class ImapFolderPusher extends ImapFolder {
long newUid = Long.parseLong(messageList.get(0).getUid()); long newUid = Long.parseLong(messageList.get(0).getUid());
if (K9MailLib.isDebug()) { if (K9MailLib.isDebug()) {
Timber.i("Got newUid " + newUid + " for message " + end + " on " + getLogId()); Timber.i("Got newUid %s for message %d on %s", newUid, end, getLogId());
} }
long startUid = oldUidNext; long startUid = oldUidNext;
@ -580,7 +578,7 @@ class ImapFolderPusher extends ImapFolder {
if (newUid >= startUid) { if (newUid >= startUid) {
if (K9MailLib.isDebug()) { if (K9MailLib.isDebug()) {
Timber.i("Needs sync from uid " + startUid + " to " + newUid + " for " + getLogId()); Timber.i("Needs sync from uid %d to %d for %s", startUid, newUid, getLogId());
} }
List<Message> messages = new ArrayList<Message>(); List<Message> messages = new ArrayList<Message>();
@ -618,7 +616,7 @@ class ImapFolderPusher extends ImapFolder {
msgSeqUidMap.clear(); msgSeqUidMap.clear();
String existingUid = existingMessage.getUid(); String existingUid = existingMessage.getUid();
Timber.w("Message with UID " + existingUid + " still exists on server, not expunging"); Timber.w("Message with UID %s still exists on server, not expunging", existingUid);
removeUids.remove(existingUid); removeUids.remove(existingUid);
} }
@ -629,7 +627,7 @@ class ImapFolderPusher extends ImapFolder {
try { try {
message.setFlagInternal(Flag.DELETED, true); message.setFlagInternal(Flag.DELETED, true);
} catch (MessagingException me) { } catch (MessagingException me) {
Timber.e("Unable to set DELETED flag on message " + message.getUid()); Timber.e("Unable to set DELETED flag on message %s", message.getUid());
} }
messages.add(message); messages.add(message);
@ -653,7 +651,7 @@ class ImapFolderPusher extends ImapFolder {
private void notifyMessagesArrived(long startUid, long uidNext) { private void notifyMessagesArrived(long startUid, long uidNext) {
if (K9MailLib.isDebug()) { if (K9MailLib.isDebug()) {
Timber.i("Needs sync from uid " + startUid + " to " + uidNext + " for " + getLogId()); Timber.i("Needs sync from uid %d to %d for %s", startUid, uidNext, getLogId());
} }
int count = (int) (uidNext - startUid); int count = (int) (uidNext - startUid);
@ -675,10 +673,10 @@ class ImapFolderPusher extends ImapFolder {
oldUidNext = pushState.uidNext; oldUidNext = pushState.uidNext;
if (K9MailLib.isDebug()) { if (K9MailLib.isDebug()) {
Timber.i("Got oldUidNext " + oldUidNext + " for " + getLogId()); Timber.i("Got oldUidNext %d for %s", oldUidNext, getLogId());
} }
} catch (Exception e) { } catch (Exception e) {
Timber.e("Unable to get oldUidNext for " + getLogId(), e); Timber.e(e, "Unable to get oldUidNext for %s", getLogId());
} }
return oldUidNext; return oldUidNext;

View file

@ -23,7 +23,7 @@ class ImapPushState {
return new ImapPushState(newUidNext); return new ImapPushState(newUidNext);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
Timber.e("Unable to part uidNext value " + value, e); Timber.e(e, "Unable to part uidNext value %s", value);
} }
return createDefaultImapPushState(); return createDefaultImapPushState();

View file

@ -47,7 +47,7 @@ class ImapPusher implements Pusher {
try { try {
folderPusher.refresh(); folderPusher.refresh();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Got exception while refreshing for " + folderPusher.getName(), e); Timber.e(e, "Got exception while refreshing for %s", folderPusher.getName());
} }
} }
} }
@ -63,12 +63,12 @@ class ImapPusher implements Pusher {
for (ImapFolderPusher folderPusher : folderPushers) { for (ImapFolderPusher folderPusher : folderPushers) {
try { try {
if (K9MailLib.isDebug()) { if (K9MailLib.isDebug()) {
Timber.i("Requesting stop of IMAP folderPusher " + folderPusher.getName()); Timber.i("Requesting stop of IMAP folderPusher %s", folderPusher.getName());
} }
folderPusher.stop(); folderPusher.stop();
} catch (Exception e) { } catch (Exception e) {
Timber.e("Got exception while stopping " + folderPusher.getName(), e); Timber.e(e, "Got exception while stopping %s", folderPusher.getName());
} }
} }