Added thread to main log

pull/212/head
M66B 1 year ago
parent e48cfafb60
commit 7c0d50203a

File diff suppressed because it is too large Load Diff

@ -68,7 +68,7 @@ import javax.mail.internet.InternetAddress;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 275,
version = 276,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2787,6 +2787,12 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `contact` ADD COLUMN `folder` INTEGER");
}
}).addMigrations(new Migration(275, 276) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `log` ADD COLUMN `thread` INTEGER");
}
}).addMigrations(new Migration(998, 999) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

@ -58,6 +58,7 @@ public class EntityLog {
public Long time;
@NonNull
public Type type = Type.General;
public Long thread;
public Long account;
public Long folder;
public Long message;
@ -127,6 +128,7 @@ public class EntityLog {
final EntityLog entry = new EntityLog();
entry.time = new Date().getTime();
entry.type = type;
entry.thread = Thread.currentThread().getId();
entry.account = account;
entry.folder = folder;
entry.message = message;

@ -2735,9 +2735,10 @@ public class Log {
DateFormat TF = Helper.getTimeInstance(context);
for (EntityLog entry : db.log().getLogs(from, null)) {
size += write(os, String.format("%s [%d:%d:%d:%d] %s\r\n",
size += write(os, String.format("%s [%d:%d:%d:%d:%d] %s\r\n",
TF.format(entry.time),
entry.type.ordinal(),
(entry.thread == null ? 0 : entry.thread),
(entry.account == null ? 0 : entry.account),
(entry.folder == null ? 0 : entry.folder),
(entry.message == null ? 0 : entry.message),

Loading…
Cancel
Save