import-log: add output to logcat (for debugging)

This commit is contained in:
Vincent Breitmoser 2014-06-06 17:28:36 +02:00
parent e083ccc370
commit 118225d7d2
3 changed files with 19 additions and 8 deletions

View File

@ -126,10 +126,13 @@ public class OperationResultParcel implements Parcelable {
MSG_IS_SUCCESS (R.string.msg_is_success),
;
private int mMsgId;
private final int mMsgId;
LogType(int msgId) {
mMsgId = msgId;
}
public int getMsgId() {
return mMsgId;
}
}
/** Enumeration of possible log levels. */

View File

@ -152,13 +152,14 @@ public class PgpImportExport {
}
}
mProviderHelper.savePublicKeyRing(key);
/*switch(status) {
case RETURN_UPDATED: oldKeys++; break;
case RETURN_OK: newKeys++; break;
case RETURN_BAD: badKeys++; break;
}*/
// TODO proper import feedback
mProviderHelper.resetLog();
OperationResultParcel result = mProviderHelper.savePublicKeyRing(key);
for(OperationResultParcel.LogEntryParcel loge : result.mLog) {
Log.d(Constants.TAG,
loge.mIndent
+ new String(new char[loge.mIndent]).replace("\0", " ")
+ mContext.getString(loge.mType.getMsgId(), (Object[]) loge.mParameters));
}
newKeys += 1;
} catch (PgpGeneralException e) {

View File

@ -79,6 +79,13 @@ public class ProviderHelper {
mIndent = indent;
}
public void resetLog() {
if(mLog != null) {
mLog.clear();
mIndent = 0;
}
}
public static class NotFoundException extends Exception {
public NotFoundException() {
}