def evdump(app=None, out=sys.stdout):
 app = app_or_default(app)
 dumper = Dumper(out=out)
 dumper.say(u'-> evdump: starting capture...')
 conn = app.connection_for_read().clone()
 def _error_handler(exc, interval):
  dumper.say((CONNECTION_ERROR % (conn.as_uri(), exc, humanize_seconds(interval, u'in', u' '))))
 while 1:
  try:
   conn.ensure_connection(_error_handler)
   recv = app.events.Receiver(conn, handlers={u'*': dumper.on_event})
   recv.capture()
  except (KeyboardInterrupt, SystemExit):
   return (conn and conn.close())
  except (conn.connection_errors + conn.channel_errors):
   dumper.say(u'-> Connection lost, attempting reconnect')

def evdump ( app = None , out = sys . stdout ) : app = app_or_default ( app ) dumper = Dumper ( out = out ) dumper . say ( u'-> evdump: starting capture...' ) conn = app . connection_for_read ( ) . clone ( ) def _error_handler ( exc , interval ) : dumper . say ( ( CONNECTION_ERROR % ( conn . as_uri ( ) , exc , humanize_seconds ( interval , u'in' , u' ' ) ) ) ) while 1 : try : conn . ensure_connection ( _error_handler ) recv = app . events . Receiver ( conn , handlers = { u'*' : dumper . on_event } ) recv . capture ( ) except ( KeyboardInterrupt , SystemExit ) : return ( conn and conn . close ( ) ) except ( conn . connection_errors + conn . channel_errors ) : dumper . say ( u'-> Connection lost, attempting reconnect' )
start event dump .