code: def setup_logging(handler, exclude=("gunicorn", "south", "elasticapm.errors")):
      
      logger = logging.getLogger()
      if handler.__class__ in map(type, logger.handlers):
          return False
  
      logger.addHandler(handler)
  
      return True
docs: Configures logging to pipe to Elastic APM.
  
      - ``exclude`` is a list of loggers that shouldn't go to ElasticAPM.
  
      For a typical Python install:
  
      >>> from elasticapm.handlers.logging import LoggingHandler
      >>> client = ElasticAPM(...)
      >>> setup_logging(LoggingHandler(client))
  
      Within Django:
  
      >>> from elasticapm.contrib.django.handlers import LoggingHandler
      >>> setup_logging(LoggingHandler())
  
      Returns a boolean based on if logging was configured or not.