-
-
Save bjcubsfan/5305978 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def objectify(frame): | |
""" yeilds one parsed object defined by the parsers in | |
the waas library. | |
""" | |
parsers = {'SP': sp_log.parse, | |
'CP': cp_log.parse, | |
'WAAS': waas_log.parse, | |
} | |
log_source = frame['log_type'] | |
if log_source in parsers: | |
parse = parsers[ log_source ] | |
for [(raw_line, channel, msg) for raw_line in frame['lines'] for channel, msg in parse(raw_line)]: | |
if channel: | |
msg.update({'site': frame['site_name']}) | |
yield {'channel': log_source + '.' + channel, | |
'msg': msg} | |
else: # channel was None | |
yield {'channel': log_source + '.' + 'UNPARSED', | |
'msg': {'line': raw_line, | |
'site': frame['site_name']}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment