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

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

@ -2735,9 +2735,10 @@ public class Log {
DateFormat TF = Helper.getTimeInstance(context); DateFormat TF = Helper.getTimeInstance(context);
for (EntityLog entry : db.log().getLogs(from, null)) { 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), TF.format(entry.time),
entry.type.ordinal(), entry.type.ordinal(),
(entry.thread == null ? 0 : entry.thread),
(entry.account == null ? 0 : entry.account), (entry.account == null ? 0 : entry.account),
(entry.folder == null ? 0 : entry.folder), (entry.folder == null ? 0 : entry.folder),
(entry.message == null ? 0 : entry.message), (entry.message == null ? 0 : entry.message),

Loading…
Cancel
Save