code: def get_current_environ():
      
      thread_local = AutomatedLoggingMiddleware.thread_local
      if hasattr(thread_local, 'request_uri'):
          request_uri = thread_local.request_uri
      else:
          request_uri = None
  
      if hasattr(thread_local, 'application'):
          application = thread_local.application
          application = Application.objects.get_or_create(name=application)[0]
      else:
          application = None
  
      if hasattr(thread_local, 'method'):
          method = thread_local.method
      else:
          method = None
  
      if hasattr(thread_local, 'status'):
          status = thread_local.status
      else:
          status = None
  
      return request_uri, application, method, status
docs: Get current application and path object from middleware