Use Timber instead of Android.Log
This commit is contained in:
@@ -46,7 +46,6 @@ import org.sufficientlysecure.keychain.operations.results.PgpSignEncryptResult;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpSignEncryptData;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpSignEncryptInputParcel;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpSignEncryptOperation;
|
||||
import org.sufficientlysecure.keychain.pgp.Progressable;
|
||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||
@@ -61,7 +60,7 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.CountingOutputStream;
|
||||
import org.sufficientlysecure.keychain.util.InputData;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
/**
|
||||
@@ -259,7 +258,7 @@ public class BackupOperation extends BaseOperation<BackupKeyringParcel> {
|
||||
if (outStream != null) try {
|
||||
outStream.close();
|
||||
} catch (Exception e) {
|
||||
Log.e(Constants.TAG, "error closing stream", e);
|
||||
Timber.e(e, "error closing stream");
|
||||
}
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ import org.sufficientlysecure.keychain.pgp.SignEncryptParcel;
|
||||
import org.sufficientlysecure.keychain.provider.KeyWritableRepository;
|
||||
import org.sufficientlysecure.keychain.service.BenchmarkInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Passphrase;
|
||||
import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
public class BenchmarkOperation extends BaseOperation<BenchmarkInputParcel> {
|
||||
@@ -139,7 +139,7 @@ public class BenchmarkOperation extends BaseOperation<BenchmarkInputParcel> {
|
||||
iterationsFor100ms = iterations;
|
||||
|
||||
} catch (PGPException e) {
|
||||
Log.e(Constants.TAG, "internal error during benchmark", e);
|
||||
Timber.e(e, "internal error during benchmark");
|
||||
log.add(LogType.MSG_INTERNAL_ERROR, 0);
|
||||
return new BenchmarkResult(BenchmarkResult.RESULT_ERROR, log);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.keyimport.FacebookKeyserverClient;
|
||||
import org.sufficientlysecure.keychain.keyimport.HkpKeyserverAddress;
|
||||
@@ -62,11 +61,12 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.IteratorWithSize;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableFileCache;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableProxy;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
/**
|
||||
* An operation class which implements high level import
|
||||
@@ -248,7 +248,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
|
||||
|
||||
log.add(result, 2);
|
||||
} catch (IOException | PgpGeneralException e) {
|
||||
Log.e(Constants.TAG, "Encountered bad key on import!", e);
|
||||
Timber.e(e, "Encountered bad key on import!");
|
||||
++badKeys;
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
|
||||
} catch (KeyserverClient.QueryNotFoundException e) {
|
||||
throw e;
|
||||
} catch (KeyserverClient.QueryFailedException e) {
|
||||
Log.d(Constants.TAG, "query failed", e);
|
||||
Timber.d(e, "query failed");
|
||||
log.add(LogType.MSG_IMPORT_FETCH_ERROR_KEYSERVER, 3, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
@@ -426,7 +426,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
|
||||
return keybaseKey;
|
||||
} catch (KeyserverClient.QueryFailedException e) {
|
||||
// download failed, too bad. just proceed
|
||||
Log.e(Constants.TAG, "query failed", e);
|
||||
Timber.e(e, "query failed");
|
||||
log.add(LogType.MSG_IMPORT_FETCH_ERROR_KEYSERVER, 3, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
@@ -452,7 +452,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
|
||||
return facebookKey;
|
||||
} catch (KeyserverClient.QueryFailedException e) {
|
||||
// download failed, too bad. just proceed
|
||||
Log.e(Constants.TAG, "query failed", e);
|
||||
Timber.e(e, "query failed");
|
||||
log.add(LogType.MSG_IMPORT_FETCH_ERROR_KEYSERVER, 3, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
@@ -515,7 +515,7 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
|
||||
private ImportKeyResult multiThreadedKeyImport(List<ParcelableKeyRing> keyList,
|
||||
final HkpKeyserverAddress keyServer, final ParcelableProxy proxy,
|
||||
final boolean skipSave) {
|
||||
Log.d(Constants.TAG, "Multi-threaded key import starting");
|
||||
Timber.d("Multi-threaded key import starting");
|
||||
|
||||
final Iterator<ParcelableKeyRing> keyListIterator = keyList.iterator();
|
||||
final int totKeys = keyList.size();
|
||||
@@ -555,8 +555,8 @@ public class ImportOperation extends BaseReadWriteOperation<ImportKeyringParcel>
|
||||
try {
|
||||
accumulator.accumulateKeyImport(importCompletionService.take().get());
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
Log.e(Constants.TAG, "A key could not be imported during multi-threaded " +
|
||||
"import", e);
|
||||
Timber.e(e, "A key could not be imported during multi-threaded " +
|
||||
"import");
|
||||
// do nothing?
|
||||
if (e instanceof ExecutionException) {
|
||||
// Since serialKeyRingImport does not throw any exceptions, this is what
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.operations.results.EditKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.RevokeResult;
|
||||
@@ -35,7 +34,8 @@ import org.sufficientlysecure.keychain.service.RevokeKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
||||
public class RevokeOperation extends BaseReadWriteOperation<RevokeKeyringParcel> {
|
||||
|
||||
@@ -97,7 +97,7 @@ public class RevokeOperation extends BaseReadWriteOperation<RevokeKeyringParcel>
|
||||
}
|
||||
|
||||
} catch (PgpKeyNotFoundException | KeyWritableRepository.NotFoundException e) {
|
||||
Log.e(Constants.TAG, "could not find key to revoke", e);
|
||||
Timber.e(e, "could not find key to revoke");
|
||||
log.add(OperationResult.LogType.MSG_REVOKE_ERROR_KEY_FAIL, 1);
|
||||
return new RevokeResult(RevokeResult.RESULT_ERROR, log, masterKeyId);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.bouncycastle.bcpg.ArmoredOutputStream;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.keyimport.HkpKeyserverClient;
|
||||
import org.sufficientlysecure.keychain.keyimport.KeyserverClient.AddKeyException;
|
||||
@@ -42,10 +41,10 @@ import org.sufficientlysecure.keychain.service.UploadKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableProxy;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import org.sufficientlysecure.keychain.network.orbot.OrbotHelper;
|
||||
import timber.log.Timber;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -130,7 +129,7 @@ public class UploadOperation extends BaseOperation<UploadKeyringParcel> {
|
||||
return null;
|
||||
} catch (IOException | PgpGeneralException e) {
|
||||
log.add(LogType.MSG_UPLOAD_ERROR_IO, 1);
|
||||
Log.e(Constants.TAG, "error uploading key", e);
|
||||
Timber.e(e, "error uploading key");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -159,12 +158,12 @@ public class UploadOperation extends BaseOperation<UploadKeyringParcel> {
|
||||
log.add(LogType.MSG_UPLOAD_SUCCESS, 1);
|
||||
return new UploadResult(UploadResult.RESULT_OK, log);
|
||||
} catch (IOException e) {
|
||||
Log.e(Constants.TAG, "IOException", e);
|
||||
Timber.e(e, "IOException");
|
||||
|
||||
log.add(LogType.MSG_UPLOAD_ERROR_IO, 1);
|
||||
return new UploadResult(UploadResult.RESULT_ERROR, log);
|
||||
} catch (AddKeyException e) {
|
||||
Log.e(Constants.TAG, "AddKeyException", e);
|
||||
Timber.e(e, "AddKeyException");
|
||||
|
||||
log.add(LogType.MSG_UPLOAD_ERROR_UPLOAD, 1);
|
||||
return new UploadResult(UploadResult.RESULT_ERROR, log);
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.ui.LogDisplayActivity;
|
||||
import org.sufficientlysecure.keychain.ui.LogDisplayFragment;
|
||||
@@ -33,8 +32,8 @@ import org.sufficientlysecure.keychain.ui.util.Notify.ActionListener;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Showable;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
|
||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableCache;
|
||||
import timber.log.Timber;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -122,7 +121,7 @@ public abstract class OperationResult implements Parcelable {
|
||||
mType = type;
|
||||
mParameters = parameters;
|
||||
mIndent = indent;
|
||||
Log.v(Constants.TAG, "log: " + this);
|
||||
Timber.v("log: " + this);
|
||||
}
|
||||
|
||||
/** Clones this LogEntryParcel, adding extra indent. Note that the parameter array is NOT cloned! */
|
||||
@@ -206,7 +205,7 @@ public abstract class OperationResult implements Parcelable {
|
||||
super(type, indent, parameters);
|
||||
mSubResult = subResult;
|
||||
|
||||
Log.v(Constants.TAG, "log: " + this);
|
||||
Timber.v("log: " + this);
|
||||
}
|
||||
|
||||
public SubLogEntryParcel(Parcel source) {
|
||||
@@ -264,7 +263,7 @@ public abstract class OperationResult implements Parcelable {
|
||||
|
||||
LogEntryParcel entryParcel = mLog.getLast();
|
||||
if (entryParcel == null) {
|
||||
Log.e(Constants.TAG, "Tried to show empty log!");
|
||||
Timber.e("Tried to show empty log!");
|
||||
return Notify.create(activity, R.string.error_empty_log, Style.ERROR);
|
||||
}
|
||||
// special case: first parameter may be a quantity
|
||||
|
||||
Reference in New Issue
Block a user