def validate_log_format(self, log):
keys_in_log = set(log)<EOL>keys_in_log_structure = set(self.LOG_STRUCTURE)<EOL>try:<EOL><INDENT>assert (keys_in_log == keys_in_log_structure)<EOL><DEDENT>except AssertionError as e:<EOL><INDENT>self.log.warning('<STR_LIT>' ,<EOL>key_not_found = list(keys_in_log_structure-keys_in_log),<EOL>extra_keys_found = list(keys_in_log-keys_in_log_structure),<EOL>num_logs=<NUM_LIT:1>,<EOL>type='<STR_LIT>')<EOL>return '<STR_LIT>'<EOL><DEDENT>for key in log:<EOL><INDENT>try:<EOL><INDENT>assert isinstance(log[key], self.LOG_STRUCTURE[key])<EOL><DEDENT>except AssertionError as e:<EOL><INDENT>self.log.warning('<STR_LIT>' ,<EOL>key_datatype_not_matched = key,<EOL>datatype_expected = type(self.LOG_STRUCTURE[key]),<EOL>datatype_got = type(log[key]),<EOL>num_logs=<NUM_LIT:1>,<EOL>type='<STR_LIT>')<EOL>return '<STR_LIT>'<EOL><DEDENT><DEDENT>return '<STR_LIT>'<EOL>
>>> lc = LogCollector('file=/path/to/file.log:formatter=logagg.formatters.basescript', 30)

>>> incomplete_log = {'data' : {'x' : 1, 'y' : 2},
...                     'raw' : 'Not all keys present'}
>>> lc.validate_log_format(incomplete_log)
'failed'

>>> redundant_log = {'one_invalid_key' : 'Extra information',
...  'data': {'x' : 1, 'y' : 2},
...  'error': False,
...  'error_tb': '',
...  'event': 'event',
...  'file': '/path/to/file.log',
...  'formatter': 'logagg.formatters.mongodb',
...  'host': 'deepcompute-ThinkPad-E470',
...  'id': '0112358',
...  'level': 'debug',
...  'raw': 'some log line here',
...  'timestamp': '2018-04-07T14:06:17.404818',
...  'type': 'log'}
>>> lc.validate_log_format(redundant_log)
'failed'

>>> correct_log = {'data': {'x' : 1, 'y' : 2},
...  'error': False,
...  'error_tb': '',
...  'event': 'event',
...  'file': '/path/to/file.log',
...  'formatter': 'logagg.formatters.mongodb',
...  'host': 'deepcompute-ThinkPad-E470',
...  'id': '0112358',
...  'level': 'debug',
...  'raw': 'some log line here',
...  'timestamp': '2018-04-07T14:06:17.404818',
...  'type': 'log'}
>>> lc.validate_log_format(correct_log)
'passed'