mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Added logging
This commit is contained in:
parent
f1a573ced5
commit
b8575fe18a
1 changed files with 13 additions and 2 deletions
|
@ -1043,6 +1043,7 @@ public class FragmentFolders extends FragmentBase {
|
|||
List<EntityRule> rules = db.rule().getEnabledRules(fid);
|
||||
if (rules == null)
|
||||
return 0;
|
||||
EntityLog.log(context, "Executing rules count=" + rules.size());
|
||||
|
||||
for (EntityRule rule : rules) {
|
||||
JSONObject jcondition = new JSONObject(rule.condition);
|
||||
|
@ -1054,6 +1055,7 @@ public class FragmentFolders extends FragmentBase {
|
|||
List<Long> ids = db.message().getMessageIdsByFolder(fid);
|
||||
if (ids == null)
|
||||
return 0;
|
||||
EntityLog.log(context, "Executing rules messages=" + ids.size());
|
||||
|
||||
int applied = 0;
|
||||
for (long mid : ids)
|
||||
|
@ -1064,19 +1066,28 @@ public class FragmentFolders extends FragmentBase {
|
|||
if (message == null)
|
||||
continue;
|
||||
|
||||
for (EntityRule rule : rules)
|
||||
EntityLog.log(context, "Executing rules message=" + message.id);
|
||||
|
||||
for (EntityRule rule : rules) {
|
||||
EntityLog.log(context, "Executing rules evaluating=" + rule.name);
|
||||
if (rule.matches(context, message, null)) {
|
||||
if (rule.execute(context, message))
|
||||
EntityLog.log(context, "Executing rules matches=" + rule.name);
|
||||
if (rule.execute(context, message)) {
|
||||
EntityLog.log(context, "Executing rules applied=" + rule.name);
|
||||
applied++;
|
||||
}
|
||||
if (rule.stop)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
EntityLog.log(context, "Executing rules applied=" + applied);
|
||||
|
||||
if (applied > 0)
|
||||
ServiceSynchronize.eval(context, "rules/manual");
|
||||
|
||||
|
|
Loading…
Reference in a new issue