def get_recent(**redis_kwargs):
 pid = getpid()
 red = StrictRedis(**redis_kwargs)
 processes = []
 messages = []
 for key in red.keys('pid-*-statuses'):
  try:
   now = time()
   pid = int(key.split('-')[1])
   msgs = [msg.split(' ', 1) for msg in red.lrange(key, 0, _keep)]
   msgs = [((now - float(t)), pid, msg) for (t, msg) in msgs]
  except:
   continue
  else:
   messages += msgs
   processes += msgs[:1]
 messages.sort()
 processes.sort()
 return (processes, messages)

def get_recent ( ** redis_kwargs ) : pid = getpid ( ) red = StrictRedis ( ** redis_kwargs ) processes = [ ] messages = [ ] for key in red . keys ( 'pid-*-statuses' ) : try : now = time ( ) pid = int ( key . split ( '-' ) [ 1 ] ) msgs = [ msg . split ( ' ' , 1 ) for msg in red . lrange ( key , 0 , _keep ) ] msgs = [ ( ( now - float ( t ) ) , pid , msg ) for ( t , msg ) in msgs ] except : continue else : messages += msgs processes += msgs [ : 1 ] messages . sort ( ) processes . sort ( ) return ( processes , messages )
retrieve recent messages from redis .