def main(): log.configure() data = pkg_resources.resource_stream(__package__, '__init__.py') log.info('Writing local copy of v2 to v2.py...') with open('v2.py', 'wb') as h: h.write(data.read()) log.info('Appending v2.py and VERSION to MANIFEST.in...') data = pkg_resources.resource_stream(__package__, 'MANIFEST.in') with open('MANIFEST.in', 'ab') as h: h.write(data.read())
def ahab(connection, console=None, syslog=None): log.configure(stderr=console, syslog=syslog) log.info('Under weigh.') try: Ahab(connection).listen() except KeyboardInterrupt: log.warning("It's CTRL-C!") except Exception: log.exception("It wasn't unexpected!") sys.exit(2) log.info('Hove to.')
def default(event, data): """The default handler prints basic event info.""" messages = defaultdict(lambda: 'Avast:') messages['start'] = 'Thar she blows!' messages['tag'] = 'Thar she blows!' messages['stop'] = 'Away into the depths:' messages['destroy'] = 'Away into the depths:' messages['delete'] = 'Away into the depths:' status = get_status(event) message = messages[status] + ' %s/%s' log.info(message, status, get_id(event)) log.debug('"data": %s', form_json(data))
def main(): log.configure(stderr='debug') log.info('Piloting Kazoo now, Woooohooooo!') try: holaPilot() except Exception as e: log.error('It wasn\'t expected!') log.exception(e) sys.exit(2) except: log.error('python f-ed up') log.exception(e) sys.exit(2) log.info("What now?")
def synchronize(): data = sorted(ec2.instances()) log.info('Synchronizing data for %s instances.', len(data)) db.load(data)