docs: def setup_extended_logging(opts):
      '''
      Setup any additional logging handlers, internal or external
      '''
      if is_extended_logging_configured() is True:
          # Don't re-configure external loggers
          return
  
      # Explicit late import of salt's loader
      import salt.loader
  
      # Let's keep a reference to the current logging handlers
      initial_handlers = logging.root.handlers[:]
  
      # Load any additional logging handlers
      providers = salt.loader.log_handlers(opts)
  
      # Let's keep track of the new logging handlers so we can sync the stored
      # log records with them
      additional_handlers = []
  
      for name, get_handlers_func in six.iteritems(providers):
          logging.getLogger(__name__).info('Processing `log_handlers.%s`', name)
          # Keep a reference to the logging handlers count before getting the
          # possible additional ones.
          initial_handlers_count = len(logging.root.handlers)
  
          handlers = get_handlers_func()
          if isinstance(handlers, types.GeneratorType):
              handlers = list(handlers)
          elif handlers is False or handlers == [False]:
              # A false return value means not configuring any logging handler on
              # purpose
              logging.getLogger(__name__).info(
                  'The `log_handlers.%s.setup_handlers()` function returned '
                  '`False` which means no logging handler was configured on '
                  'purpose. Continuing...', name
              )
              continue
          else:
              # Make sure we have an iterable
              handlers = [handlers]
  
          for handler in handlers:
              if not handler and \
                      len(logging.root.handlers) == initial_handlers_count:
                  logging.getLogger(__name__).info(
                      'The `log_handlers.%s`, did not return any handlers '
                      'and the global handlers count did not increase. This '
                      'could be a sign of `log_handlers.%s` not working as '
                      'supposed', name, name
                  )
                  continue
  
              logging.getLogger(__name__).debug(
                  'Adding the \'%s\' provided logging handler: \'%s\'',
                  name, handler
              )
              additional_handlers.append(handler)
              logging.root.addHandler(handler)
  
      for handler in logging.root.handlers:
          if handler in initial_handlers:
              continue
          additional_handlers.append(handler)
  
      # Sync the null logging handler messages with the temporary handler
      if LOGGING_STORE_HANDLER is not None:
          LOGGING_STORE_HANDLER.sync_with_handlers(additional_handlers)
      else:
          logging.getLogger(__name__).debug(
              'LOGGING_STORE_HANDLER is already None, can\'t sync messages '
              'with it'
          )
  
      # Remove the temporary queue logging handler
      __remove_queue_logging_handler()
  
      # Remove the temporary null logging handler (if it exists)
      __remove_null_logging_handler()
  
      global __EXTERNAL_LOGGERS_CONFIGURED
      __EXTERNAL_LOGGERS_CONFIGURED = True