|
@ -22,6 +22,8 @@ package eu.faircode.email; |
|
|
import android.content.Context; |
|
|
import android.content.Context; |
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
|
|
import java.util.concurrent.Executors; |
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
import androidx.annotation.NonNull; |
|
|
import androidx.room.Entity; |
|
|
import androidx.room.Entity; |
|
@ -46,11 +48,21 @@ public class EntityLog { |
|
|
@NonNull |
|
|
@NonNull |
|
|
public String data; |
|
|
public String data; |
|
|
|
|
|
|
|
|
|
|
|
private static ExecutorService executor = Executors.newSingleThreadExecutor(); |
|
|
|
|
|
|
|
|
static void log(Context context, String data) { |
|
|
static void log(Context context, String data) { |
|
|
EntityLog entry = new EntityLog(); |
|
|
|
|
|
|
|
|
final EntityLog entry = new EntityLog(); |
|
|
entry.time = new Date().getTime(); |
|
|
entry.time = new Date().getTime(); |
|
|
entry.data = data; |
|
|
entry.data = data; |
|
|
DB.getInstance(context).log().insertLog(entry); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final DB db = DB.getInstance(context); |
|
|
|
|
|
|
|
|
|
|
|
executor.submit(new Runnable() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
db.log().insertLog(entry); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|