if profile is in debug, log debug even if it matched the profile
@@ -84,8 +84,12 @@ PROFILE_LOOP:
log.Warningf("failed to run whitelist expr : %v", err)
return nil, errors.Wrapf(err, "while running expression %s", profile.Filters[eIdx])
}
+
switch out := output.(type) {
case bool:
+ if profile.Debug != nil && *profile.Debug {
+ profile.DebugFilters[eIdx].Run(clog, out, exprhelpers.GetExprEnv(map[string]interface{}{"Alert": Alert}))
+ }
if out {
matched = true
/*the expression matched, create the associated decision*/
@@ -96,9 +100,6 @@ PROFILE_LOOP:
decisions = append(decisions, subdecisions...)
} else {
- if profile.Debug != nil && *profile.Debug {
- profile.DebugFilters[eIdx].Run(clog, false, exprhelpers.GetExprEnv(map[string]interface{}{"Alert": Alert}))
- }
log.Debugf("Profile %s filter is unsuccessful", profile.Name)
if profile.OnFailure == "break" {
break PROFILE_LOOP
