Alon Bar-Lev has uploaded a new change for review. Change subject: core: log: support overlapping filters ......................................................................
core: log: support overlapping filters currently we filter using simple substitution, this is not good for overlapping patterns. filter: aaabbbccc when filter is: bbb aaabbbccc or: bcc bbb etc... Change-Id: I512425cf2d1f56cdaf1c386fa105f7e335ae10c4 Signed-off-by: Alon Bar-Lev <alo...@redhat.com> --- M src/plugins/otopi/core/log.py 1 file changed, 22 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/06/25406/1 diff --git a/src/plugins/otopi/core/log.py b/src/plugins/otopi/core/log.py index c135269..91b2d00 100644 --- a/src/plugins/otopi/core/log.py +++ b/src/plugins/otopi/core/log.py @@ -84,6 +84,7 @@ def format(self, record): msg = logging.Formatter.format(self, record) + tofilter = [] for f in ( self.environment[constants.CoreEnv.LOG_FILTER]._list + [ @@ -92,7 +93,27 @@ ] ): if f not in (None, ''): - msg = msg.replace(f, '**FILTERED**') + index = -1 + while True: + index = msg.find(f, index+1) + if index == -1: + break + tofilter.append((index, index + len(f))) + + tofilter = sorted(tofilter, key=lambda e: e[1], reverse=True) + begin = None + end = None + for entry in tofilter: + if begin is None or entry[1] < begin: + if begin is not None: + msg = msg[:begin] + '**FILTERED**' + msg[end:] + begin = entry[0] + end = entry[1] + elif entry[0] < begin: + begin = entry[0] + else: + if begin is not None: + msg = msg[:begin] + '**FILTERED**' + msg[end:] return msg -- To view, visit http://gerrit.ovirt.org/25406 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I512425cf2d1f56cdaf1c386fa105f7e335ae10c4 Gerrit-PatchSet: 1 Gerrit-Project: otopi Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches