o
    /h                     @   s<   d dl Z d dlmZ d dlmZ edZG dd deZdS )    N)BaseCommand)	getLoggerzdjango.commandsc                       s    e Zd ZdZ fddZ  ZS )LoggingBaseCommanda  
    A subclass of BaseCommand that logs run time errors to `django.commands`.
    To use this, create a management command subclassing LoggingBaseCommand:

        from django_extensions.management.base import LoggingBaseCommand

        class Command(LoggingBaseCommand):
            help = 'Test error'

            def handle(self, *args, **options):
                raise Exception


    And then define a logging handler in settings.py:

        LOGGING = {
            ... # Other stuff here

            'handlers': {
                'mail_admins': {
                    'level': 'ERROR',
                    'filters': ['require_debug_false'],
                    'class': 'django.utils.log.AdminEmailHandler'
                },
            },
            'loggers': {
                'django.commands': {
                    'handlers': ['mail_admins'],
                    'level': 'ERROR',
                    'propagate': False,
                },
            }

        }

    c              
      sL   zt  j|i | W d S  ty% } ztj|t ddid  d }~ww )Nstatus_codei  )exc_infoextra)superexecute	Exceptionloggererrorsysr   )selfargsoptionse	__class__ \/var/www/html/env_mimamsha/lib/python3.10/site-packages/django_extensions/management/base.pyr	   0   s   zLoggingBaseCommand.execute)__name__
__module____qualname____doc__r	   __classcell__r   r   r   r   r   
   s    %r   )r   django.core.management.baser   loggingr   r   r   r   r   r   r   <module>   s
   