def get_messages(self, start=None): if not self.exists: return with io.open(self.path, encoding='utf-8', errors='replace') as fp: for msg in parse_log(fp, start): yield msg
def messages(channel_id, channel, filename): with io.open(filename, encoding='utf-8', errors='replace') as fp: for msg in parse_log(fp): if msg['type'] == 'privmsg': print_xml(channel_id, channel, msg)