def contains(self, logger, level, message, is_regex=False):
for record in self.records:<EOL><INDENT>if record.name != logger or record.levelno != level:<EOL><INDENT>continue<EOL><DEDENT>if is_regex:<EOL><INDENT>if re.search(message, (record.msg % record.args)):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if message in (record.msg % record.args):<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT>return False<EOL>
Checks whether a message has been logged to a specific logger with a
specific level.

:param logger: The logger.
:param level: The log level.
:param messgae: The message contents.
:param is_regex: Whether the expected message is a regex or not.
    Non-regex messages are simply tested for inclusion.