def get_after(self, timestamp, s=None):
"""
Find all the (available) logs that are after the given time stamp.
Override this function in class LogFileOutput.
Parameters:
timestamp(datetime.datetime): lines before this time are ignored.
s(str or list): one or more strings to search for.
If not supplied, all available lines are searched.
Yields:
(dict): the parsed data of lines with timestamps after this date in the
same format they were supplied.
"""
search_by_expression = self._valid_search(s)
for line in self.lines:
# If `s` is not None, keywords must be found in the line
if s and not search_by_expression(line):
continue
info = self._parse_line(line)
try:
logtime = date.fromtimestamp(float(info.get('timestamp', 0)))
if logtime > timestamp:
yield info
except:
pass
评论列表
文章目录