scenario.logfilters module

Log filtering.

class LoggerLogFilter

Bases: Filter

Log filter attached to a Logger instance.

Filters log records depending on the log level and the associated logger configuration.

__init__(logger)
Parameters:

logger – Attached Logger instance.

_logger

Attached scenario Logger instance.

filter(record)

Filtering hook implementation.

Parameters:

record – Log record to check for filtering.

Returns:

See logging.Filter.filter(): “Is the specified record to be logged? Returns 0 for no, nonzero for yes.”

Nevertheless, we can see from the code that booleans are actually returned.

Checks whether the log record should be filtered out due to the attached Logger configuration.

class HandlerLogFilter

Bases: Filter

Log filter attached to a logging.Handler instance.

Filters log records depending on scenario configurations: ScenarioConfig.Key.LOG_CONSOLE and ScenarioConfig.Key.LOG_FILE.

__init__(handler)
Parameters:

handler – Attached logging.Handler.

_handler

Attached logging.Handler.

filter(record)

Filtering hook implementation.

Parameters:

record – Log record to check for filtering.

Returns:

See logging.Filter.filter(): “Is the specified record to be logged? Returns 0 for no, nonzero for yes.”

Nevertheless, we can see from the code that booleans are actually returned.

Checks the ScenarioConfig.Key.LOG_CONSOLE or ScenarioConfig.Key.LOG_FILE configurations, depending on the handler attached.