code: def setup_logging(args, conf):
      
      logging_format = "%(asctime)s [%(levelname)s]: %(name)s (%(module)s.%(funcName)s; " \
                       "%(filename)s:%(lineno)d)\n    %(message)s"
  
      if getattr(args, "verbose", None):
          debug_logger = logging.StreamHandler(sys.stdout)
          debug_logger.addFilter(LogLevelFilter(max_level=logging.WARNING))
          debug_logger.setFormatter(logging.Formatter(logging_format))
          logging.root.addHandler(debug_logger)
          logging.root.level = logging.DEBUG
  
      error_logger = logging.StreamHandler(sys.stderr)
      error_logger.addFilter(LogLevelFilter(min_level=logging.ERROR))
      error_logger.setFormatter(logging.Formatter(logging_format))
      logging.root.addHandler(error_logger)
  
      if conf['logging']:
          logging.config.dictConfig(conf['logging'])
docs: Setup logging