Use Android's logging instead of printing stacktraces to STDERR
This commit is contained in:
parent
b8e9e60666
commit
6da59c8192
1 changed files with 5 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import android.content.ActivityNotFoundException;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.stevesoltys.backup.activity.backup.CreateBackupActivity;
|
import com.stevesoltys.backup.activity.backup.CreateBackupActivity;
|
||||||
|
|
@ -35,6 +36,8 @@ import static com.stevesoltys.backup.settings.SettingsManager.setBackupFolderUri
|
||||||
*/
|
*/
|
||||||
class MainActivityController {
|
class MainActivityController {
|
||||||
|
|
||||||
|
private static final String TAG = MainActivityController.class.getName();
|
||||||
|
|
||||||
private static final String DOCUMENT_MIME_TYPE = "application/octet-stream";
|
private static final String DOCUMENT_MIME_TYPE = "application/octet-stream";
|
||||||
private static final String DOCUMENT_SUFFIX = "yyyy-MM-dd_HH_mm_ss";
|
private static final String DOCUMENT_SUFFIX = "yyyy-MM-dd_HH_mm_ss";
|
||||||
|
|
||||||
|
|
@ -48,7 +51,7 @@ class MainActivityController {
|
||||||
showCreateBackupActivity(parent, fileUri);
|
showCreateBackupActivity(parent, fileUri);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
Log.w(TAG, "Error creating backup file: ", e);
|
||||||
showChooseFolderActivity(parent, true);
|
showChooseFolderActivity(parent, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,9 +120,9 @@ class MainActivityController {
|
||||||
showCreateBackupActivity(parent, fileUri);
|
showCreateBackupActivity(parent, fileUri);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "Error creating backup file: ", e);
|
||||||
// TODO show better error message once more infrastructure is in place
|
// TODO show better error message once more infrastructure is in place
|
||||||
Toast.makeText(parent, "Error creating backup file", Toast.LENGTH_SHORT).show();
|
Toast.makeText(parent, "Error creating backup file", Toast.LENGTH_SHORT).show();
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue