
    jg                     J    d dl Z d dlmZ d dlmZ  ed      Z G d de      Zy)    N)BaseCommand)	getLoggerzdjango.commandsc                   "     e Zd ZdZ fdZ x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                     	 t        |   |i | y # t        $ r2}t        j	                  |t        j                         ddi        d }~ww xY w)Nstatus_codei  )exc_infoextra)superexecute	Exceptionloggererrorsysr	   )selfargsoptionse	__class__s       \/var/www/html/Stanley/venv/lib/python3.12/site-packages/django_extensions/management/base.pyr   zLoggingBaseCommand.execute0   sI    	GOT-W- 	LLS\\^M3;OLP	s    	A-A		A)__name__
__module____qualname____doc__r   __classcell__)r   s   @r   r   r   
   s    #J     r   )r   django.core.management.baser   loggingr   r   r    r   r   <module>r       s%    
 3 	$	%+ +r   