
    i                         U d dl Z d dlZd dlZd dlmZmZ e j                  ae j                  Z	dZ
i aeeef   ed<   	 dddddee   dee   deeeef      fd	Zd
ede j                   fdZ e        y)    N)DictOptionalzrun.logMODULE_OVERRIDES)
file_level	overrideslevelr   r   c                   | | a |t        j                  |       t        j                         }t
        j                  j                  t              }d}t        |j                        D ]O  }t        |t        j                        s	 t
        j                  j                  t        |dd            |k(  r|} nQ t        |j                        D ](  }||u r|j#                  |       |j%                          * |j'                  t        j(                         t        j*                  d      }t        j,                  t.        j0                        }	|	j'                  t                |	j3                  |       |j5                  |	       |t6        n|}
|/|j'                  |
       |j8                  `|j3                  |       nNt        j                  t        d      }|j'                  |
       |j3                  |       |j5                  |       t        j;                         D ])  \  }}t        j                  |      j'                  |       + y# t        t        t         f$ r Y w xY w)a  
    Configures the root logger with a console handler and a file handler.

    The first call creates ``run.log`` (truncate). Later calls in the same process
    refresh the console handler and file level but **reuse** the existing file handler
    so the log file is not truncated again (e.g. tests or multiple entry points).

    ``file_level``: if set, overrides the file handler level (e.g. ``logging.ERROR`` for quiet ``run.log``).
    NbaseFilename z4%(asctime)s - %(name)s - %(levelname)s - %(message)sw)mode)DEFAULT_CONSOLE_LEVELr   updatelogging	getLoggerospathabspathLOG_FILE_PATHlisthandlers
isinstanceFileHandlergetattrOSError	TypeError
ValueErrorremoveHandlerclosesetLevelDEBUG	FormatterStreamHandlersysstdoutsetFormatter
addHandlerDEFAULT_FILE_LEVEL	formatteritems)r   r   r   root_loggerlog_absexisting_file_handlerhhandlerr)   console_handlerfh_levelfile_handlermodule_namemodule_levels                 A/var/www/html/userprofiledev.eatanceapp.com/core/logger_config.pysetup_loggingr6      s	   "  %	*##%Kggoom,G;?+&&'a,,-77??71nb#ABgM,-) N ( ,,-++!!'*	 . '!!"XYI ++CJJ7O23  +?+ &0%7!ZH(&&x0 **2!..y9**=sCh'!!),|, &6%;%;%=!\+&//= &>C Y
3 s   	/II,+I,namereturnc                     t        j                  |       }t        j                         D ]2  \  }}| |k(  s| j	                  |dz         s |j                  |        |S  |S )zR
    Gets a logger instance and ensures it respects the configured overrides.
    .)r   r   r   r*   
startswithr    )r7   loggeroverride_namer   s       r5   
get_loggerr>   S   sa     t$F !1 6 6 8u= DOOMC4G$HOOE"M !9
 M    )N)r   r$   r   typingr   r   INFOr   r!   r(   r   r   strint__annotations__r6   Loggerr>    r?   r5   <module>rG      s     
 	 !    ]]  $& $sCx. %  A> !%*.	A>C=A> A> S#X'	A>FS W^^  r?   