Filters
Several classes are provided that either include or exclude log lines based on
some test of the parsed line.
Each filter should be passed an iterable of log lines, eg.
>>> filtered = MyFilter(log)
>>> for l in filtered:
... print l
A base class Filter is provided for writing filters; this allows a new
filter to be defined just by overriding accept:
-
Filter.accept(line)[source]
Returns True if a log line should be accepted
Built-in Filters
-
class loglab.filters.DateFilter(iterable, date)[source]
Filter to include only log lines whose date matches the given date.
-
class loglab.filters.DateRangeFilter(iterable, start_date=None, end_date=None)[source]
Filter to only yield lines with dates in a given range.
Either start_date or end_date can be omitted in order to include lines from
only after, or only before the corresponding date.