Added logging

This commit is contained in:
M66B
2019-06-25 08:05:28 +02:00
parent cf03e9f94f
commit 02936de391
4 changed files with 38 additions and 4 deletions

View File

@@ -151,6 +151,9 @@ public class ServiceSend extends LifecycleService {
db.operation().deleteOperation(op.id);
} catch (Throwable ex) {
Log.e(outbox.name, ex);
EntityLog.log(
ServiceSend.this,
outbox.name + " " + Helper.formatThrowable(ex));
db.operation().setOperationError(op.id, Helper.formatThrowable(ex));
if (message != null)
@@ -363,8 +366,9 @@ public class ServiceSend extends LifecycleService {
Address[] to = imessage.getAllRecipients();
itransport.sendMessage(imessage, to);
long time = new Date().getTime();
EntityLog.log(this, "Sent via " + ident.host + "/" + ident.user +
" to " + TextUtils.join(", ", to));
EntityLog.log(this,
"Sent via " + ident.host + "/" + ident.user +
" to " + TextUtils.join(", ", to));
// Append replied/forwarded text
StringBuilder sb = new StringBuilder();
@@ -429,6 +433,8 @@ public class ServiceSend extends LifecycleService {
throw ex;
}
EntityLog.log(this, ident.name + " last attempt: " + new Date(message.last_attempt));
long now = new Date().getTime();
long delayed = now - message.last_attempt;
if (delayed > IDENTITY_ERROR_AFTER * 60 * 1000L || ex instanceof SendFailedException) {