mirror of
https://github.com/moparisthebest/keepass2android
synced 2025-01-30 14:40:21 -05:00
Added option to collect log output of JFS in file (/mnt/sdcard/keepass2android.cloud.log)
Added logging in GDrive-FS removed classpath (problem with building after workspace modifications)
This commit is contained in:
parent
3159af19cb
commit
4c68c0715c
@ -3,7 +3,6 @@
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="con" path="com.google.gdt.eclipse.managedapis.MANAGED_API_CONTAINER/drive-v2r102lv1.16.0-rc"/>
|
||||
<classpathentry exported="true" kind="lib" path="C:/Users/Philipp/AppData/Local/Android/android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
|
@ -265,6 +265,10 @@ public class GoogleDriveFileStorage extends JavaFileStorageBase {
|
||||
|
||||
};
|
||||
|
||||
public GoogleDriveFileStorage()
|
||||
{
|
||||
logDebug("Creating GDrive FileStorage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkForFileChangeFast(String path,
|
||||
@ -570,6 +574,7 @@ public class GoogleDriveFileStorage extends JavaFileStorageBase {
|
||||
|
||||
|
||||
private Drive createDriveService(String accountName, Activity activity) {
|
||||
logDebug("createDriveService "+accountName);
|
||||
GoogleAccountCredential credential = createCredential(activity);
|
||||
credential.setSelectedAccountName(accountName);
|
||||
|
||||
|
@ -1,11 +1,19 @@
|
||||
package keepass2android.javafilestorage;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.Date;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.apache.http.protocol.HTTP;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.Log;
|
||||
|
||||
public abstract class JavaFileStorageBase implements JavaFileStorage{
|
||||
@ -16,9 +24,36 @@ public abstract class JavaFileStorageBase implements JavaFileStorage{
|
||||
final static protected String NAME_ID_SEP = "-KP2A-";
|
||||
final static protected String TAG = "KP2AJ";
|
||||
|
||||
protected void logDebug(String text)
|
||||
protected synchronized void logDebug(String text)
|
||||
{
|
||||
Log.d(TAG, text);
|
||||
|
||||
File logFile = new File("/mnt/sdcard/keepass2android.cloud.log");
|
||||
if (logFile.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create an instance of SimpleDateFormat used for formatting
|
||||
// the string representation of date (month/day/year)
|
||||
SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
|
||||
|
||||
// Get the date today using Calendar object.
|
||||
java.util.Date today = Calendar.getInstance().getTime();
|
||||
// Using DateFormat format method we can create a string
|
||||
// representation of a date with the defined format.
|
||||
String reportDate = df.format(today);
|
||||
|
||||
//BufferedWriter for performance, true to set append to file flag
|
||||
BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
|
||||
buf.append(reportDate + " JFS: "+text);
|
||||
buf.newLine();
|
||||
buf.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getProtocolPrefix()
|
||||
|
Loading…
Reference in New Issue
Block a user