def __is_kms_response_with_plaintext(self, record): # pylint: disable=no-self-use
# type: (logging.LogRecord) -> bool
"""Determine if a record contains a KMS response with plaintext.
:param record: Logging record to filter
:type record: logging.LogRecord
:rtype: bool
"""
try:
return all((
record.name == 'botocore.parsers',
record.msg.startswith('Response body:'),
b'KeyId' in cast(tuple, record.args)[0],
b'Plaintext' in cast(tuple, record.args)[0]
))
except Exception: # pylint: disable=broad-except
return False
评论列表
文章目录