Improved logging

pull/184/head
M66B 4 years ago
parent d10f6efbe7
commit 75d976fa63

@ -65,6 +65,7 @@ import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
public class ServiceSend extends ServiceBase implements SharedPreferences.OnSharedPreferenceChangeListener { public class ServiceSend extends ServiceBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private TupleUnsent lastUnsent = null; private TupleUnsent lastUnsent = null;
private Network lastActive = null;
private boolean lastSuitable = false; private boolean lastSuitable = false;
private PowerManager.WakeLock wlOutbox; private PowerManager.WakeLock wlOutbox;
@ -124,7 +125,8 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
handling = ops; handling = ops;
if (process.size() > 0) { if (process.size() > 0) {
Log.i("OUTBOX process=" + TextUtils.join(",", process) + EntityLog.log(ServiceSend.this,
"Send process=" + TextUtils.join(",", process) +
" handling=" + TextUtils.join(",", handling)); " handling=" + TextUtils.join(",", handling));
executor.submit(new Runnable() { executor.submit(new Runnable() {
@ -311,7 +313,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
db.folder().setFolderError(outbox.id, null); db.folder().setFolderError(outbox.id, null);
db.folder().setFolderSyncState(outbox.id, "syncing"); db.folder().setFolderSyncState(outbox.id, "syncing");
Log.i(outbox.name + " processing operations=" + ops.size()); EntityLog.log(this, "Send processing operations=" + ops.size());
while (ops.size() > 0) { while (ops.size() > 0) {
if (!ConnectionHelper.getNetworkState(this).isSuitable()) if (!ConnectionHelper.getNetworkState(this).isSuitable())
@ -324,8 +326,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
message = db.message().getMessage(op.message); message = db.message().getMessage(op.message);
try { try {
Log.i(outbox.name + EntityLog.log(this, "Send start op=" + op.id + "/" + op.name +
" start op=" + op.id + "/" + op.name +
" msg=" + op.message + " msg=" + op.message +
" tries=" + op.tries + " tries=" + op.tries +
" args=" + op.args); " args=" + op.args);
@ -369,7 +370,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
ops.remove(op); ops.remove(op);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(outbox.name, ex); Log.e(outbox.name, ex);
EntityLog.log(this, outbox.name + " " + Log.formatThrowable(ex, false)); EntityLog.log(this, "Send " + Log.formatThrowable(ex, false));
db.operation().setOperationError(op.id, Log.formatThrowable(ex)); db.operation().setOperationError(op.id, Log.formatThrowable(ex));
if (message != null) { if (message != null) {
@ -398,7 +399,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
} else } else
throw ex; throw ex;
} finally { } finally {
Log.i(outbox.name + " end op=" + op.id + "/" + op.name); EntityLog.log(this, "Send end op=" + op.id + "/" + op.name);
db.operation().setOperationState(op.id, null); db.operation().setOperationState(op.id, null);
} }
} }

Loading…
Cancel
Save