Add rule comments for logging.
Be more explicit with log output when skipping other header matches for a single rule. FossilOrigin-Name: 0abd42e75e28170a09f5932305c82f8791180768d4da8a6840ea4fc571cbc029
This commit is contained in:
parent
22542f9864
commit
c3d931cb2e
2 changed files with 17 additions and 3 deletions
|
|
@ -266,8 +266,14 @@ proc evalRules*( msg: var Message, rules: seq[Rule], default: Maildir ): bool =
|
|||
|
||||
for rule in rules:
|
||||
var match = false
|
||||
let ruleCount = rule.match.len
|
||||
|
||||
if ruleCount > 0:
|
||||
if rule.comment == "":
|
||||
"Evaluating rule...".debug
|
||||
else:
|
||||
"Evaluating rule \"$#\"".debug( rule.comment )
|
||||
|
||||
if rule.match.len > 0: "Evaluating rule...".debug
|
||||
block thisRule:
|
||||
for header, regexp in rule.match:
|
||||
let header_chk = header.toLower
|
||||
|
|
@ -290,7 +296,9 @@ proc evalRules*( msg: var Message, rules: seq[Rule], default: Maildir ): bool =
|
|||
elif msg.headers.hasKey( header_chk ):
|
||||
values = msg.headers[ header_chk ]
|
||||
else:
|
||||
" nonexistent header, skipping others".debug
|
||||
var m = " nonexistent header"
|
||||
if ruleCount > 1: m = m & ", skipping other tests"
|
||||
m.debug
|
||||
break thisRule
|
||||
|
||||
for val in values:
|
||||
|
|
@ -308,7 +316,9 @@ proc evalRules*( msg: var Message, rules: seq[Rule], default: Maildir ): bool =
|
|||
if hmatch:
|
||||
match = true
|
||||
else:
|
||||
" no match for \"$#\", skipping others".debug( regexp )
|
||||
var m = " no match for \"$#\""
|
||||
if ruleCount > 1: m = m & ", skipping other tests"
|
||||
m.debug( regexp )
|
||||
break thisRule
|
||||
|
||||
result = match
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue