Skip to content

Commit

Permalink
fix: fix print non-match content when the log can't match regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacksgong committed Sep 1, 2017
1 parent b16281e commit 9849363
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions okcat/logprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class LogProcessor:
# tmp
last_msg_key = None
last_tag = None
pre_line_match = True

def __init__(self, hide_same_tags):
self.hide_same_tags = hide_same_tags
Expand Down Expand Up @@ -104,13 +105,25 @@ def process_decode_content(self, line, time, level, tag, process, thread, messag

match_condition = True

# filter
if self.tag_keywords is not None and tag is not None:
if not keywords_regex(tag, self.tag_keywords):
match_condition = False
self.pre_line_match = False
else:
self.pre_line_match = True



if self.line_keywords is not None:
if not keywords_regex(line, self.line_keywords):
match_condition = False
self.pre_line_match = False
else:
self.pre_line_match = True

if match_condition and tag is None and not self.pre_line_match:
match_condition = False

# if 'special world' in line:
# match_precondition = True
Expand Down

0 comments on commit 9849363

Please sign in to comment.