def _install_handlers(cp, formatters):
 hlist = cp.get('handlers', 'keys')
 if (not len(hlist)):
  return {}
 hlist = hlist.split(',')
 hlist = _strip_spaces(hlist)
 handlers = {}
 fixups = []
 for hand in hlist:
  sectname = ('handler_%s' % hand)
  klass = cp.get(sectname, 'class')
  opts = cp.options(sectname)
  if ('formatter' in opts):
   fmt = cp.get(sectname, 'formatter')
  else:
   fmt = ''
  try:
   klass = eval(klass, vars(logging))
  except (AttributeError, NameError):
   klass = _resolve(klass)
  args = cp.get(sectname, 'args')
  args = eval(args, vars(logging))
  h = klass(*args)
  if ('level' in opts):
   level = cp.get(sectname, 'level')
   h.setLevel(logging._levelNames[level])
  if len(fmt):
   h.setFormatter(formatters[fmt])
  if issubclass(klass, logging.handlers.MemoryHandler):
   if ('target' in opts):
    target = cp.get(sectname, 'target')
   else:
    target = ''
   if len(target):
    fixups.append((h, target))
  handlers[hand] = h
 for (h, t) in fixups:
  h.setTarget(handlers[t])
 return handlers

def _install_handlers ( cp , formatters ) : hlist = cp . get ( 'handlers' , 'keys' ) if ( not len ( hlist ) ) : return { } hlist = hlist . split ( ',' ) hlist = _strip_spaces ( hlist ) handlers = { } fixups = [ ] for hand in hlist : sectname = ( 'handler_%s' % hand ) klass = cp . get ( sectname , 'class' ) opts = cp . options ( sectname ) if ( 'formatter' in opts ) : fmt = cp . get ( sectname , 'formatter' ) else : fmt = '' try : klass = eval ( klass , vars ( logging ) ) except ( AttributeError , NameError ) : klass = _resolve ( klass ) args = cp . get ( sectname , 'args' ) args = eval ( args , vars ( logging ) ) h = klass ( * args ) if ( 'level' in opts ) : level = cp . get ( sectname , 'level' ) h . setLevel ( logging . _levelNames [ level ] ) if len ( fmt ) : h . setFormatter ( formatters [ fmt ] ) if issubclass ( klass , logging . handlers . MemoryHandler ) : if ( 'target' in opts ) : target = cp . get ( sectname , 'target' ) else : target = '' if len ( target ) : fixups . append ( ( h , target ) ) handlers [ hand ] = h for ( h , t ) in fixups : h . setTarget ( handlers [ t ] ) return handlers
install and return handlers .