def setup_stream_handlers(options):
 class StdoutFilter(logging.Filter, ):
  def filter(self, record):
   return (record.levelno in (logging.DEBUG, logging.INFO))
 if log.handlers:
  for handler in log.handlers:
   log.removeHandler(handler)
 stdout_handler = logging.StreamHandler(sys.stdout)
 stdout_handler.setLevel(logging.WARNING)
 stdout_handler.addFilter(StdoutFilter())
 if options.debug:
  stdout_handler.setLevel(logging.DEBUG)
 elif options.verbose:
  stdout_handler.setLevel(logging.INFO)
 else:
  stdout_handler.setLevel(logging.WARNING)
 log.addHandler(stdout_handler)
 stderr_handler = logging.StreamHandler(sys.stderr)
 stderr_handler.setLevel(logging.WARNING)
 log.addHandler(stderr_handler)

def setup_stream_handlers ( options ) : class StdoutFilter ( logging . Filter , ) : def filter ( self , record ) : return ( record . levelno in ( logging . DEBUG , logging . INFO ) ) if log . handlers : for handler in log . handlers : log . removeHandler ( handler ) stdout_handler = logging . StreamHandler ( sys . stdout ) stdout_handler . setLevel ( logging . WARNING ) stdout_handler . addFilter ( StdoutFilter ( ) ) if options . debug : stdout_handler . setLevel ( logging . DEBUG ) elif options . verbose : stdout_handler . setLevel ( logging . INFO ) else : stdout_handler . setLevel ( logging . WARNING ) log . addHandler ( stdout_handler ) stderr_handler = logging . StreamHandler ( sys . stderr ) stderr_handler . setLevel ( logging . WARNING ) log . addHandler ( stderr_handler )
setup logging stream handlers according to the options .