sawmill.filterer.level

class sawmill.filterer.level.Level(min='info', max=None, levels=['debug', 'info', 'warning', 'error'])[source]

Bases: sawmill.filterer.base.Filterer

Filter logs according to defined log level limits.

__init__(min='info', max=None, levels=['debug', 'info', 'warning', 'error'])[source]

Initialise filterer with min and max levels.

The values must be taken from passed levels array. If the value given is None then it will be as if there is not limit.

A Log level value must fall between (inclusive) the min and max values.

filter(logs)[source]

Return logs whose level is between the defined range.

Note

If a log has no level information (or a level not present in the current levels array) it will pass the filter successfully.