
    wdf                         d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	 ed             Z
d Z ej        e
          Ze                     ej        d	                     d
 Zd ZdS )zN
flask.logging
~~~~~~~~~~~~~

:copyright: 2010 Pallets
:license: BSD-3-Clause
    )absolute_importN)
LocalProxy   )requestc                  L    t           rt           j        d         nt          j        S )a  Find the most appropriate error stream for the application. If a request
    is active, log to ``wsgi.errors``, otherwise use ``sys.stderr``.

    If you configure your own :class:`logging.StreamHandler`, you may want to
    use this for the stream. If you are using file or dict configuration and
    can't import this directly, you can refer to it as
    ``ext://flask.logging.wsgi_errors_stream``.
    zwsgi.errors)r   environsysstderr     R/var/www/book.euthymeo.com/html/venv/lib/python3.11/site-packages/flask/logging.pywsgi_errors_streamr      s     .5D7?=))#*Dr   c                     |                                  | }|r3t          fd|j        D                       rdS |j        sn	|j        }|3dS )zCheck if there is a handler in the logging chain that will handle the
    given logger's :meth:`effective level <~logging.Logger.getEffectiveLevel>`.
    c              3   .   K   | ]}|j         k    V  d S )N)level).0handlerr   s     r   	<genexpr>z$has_level_handler.<locals>.<genexpr>)   s*      FF'w}%FFFFFFr   TF)getEffectiveLevelanyhandlers	propagateparent)loggercurrentr   s     @r   has_level_handlerr   !   sv     $$&&EG
 !FFFFW5EFFFFF 	4  	.  ! 5r   z6[%(asctime)s] %(levelname)s in %(module)s: %(message)sc                 X    | j         t          j        k    p| j        p| j        p| j         S )zDecide if a logger has direct configuration applied by checking
    its properties against the defaults.

    :param logger: The :class:`~logging.Logger` to inspect.
    )r   loggingNOTSETr   filtersr   )r   s    r   _has_configr!   <   s9     	& 	 ?	 >	  	r   c                    t          j        | j                  }dD ]d}t          j        |          }t          |          r?t          |          s0t	          j        d                    | j        |                      ne| j        r&|j        s|	                    t           j
                   t          |          s|                    t                     |S )a  Get the the Flask apps's logger and configure it if needed.

    The logger name will be the same as
    :attr:`app.import_name <flask.Flask.name>`.

    When :attr:`~flask.Flask.debug` is enabled, set the logger level to
    :data:`logging.DEBUG` if it is not set.

    If there is no handler for the logger's effective level, add a
    :class:`~logging.StreamHandler` for
    :func:`~flask.logging.wsgi_errors_stream` with a basic format.
    )z	flask.appflaskz'app.logger' is named '{name}' for this application, but configuration was found for '{old_name}', which no longer has an effect. The logging configuration should be moved to '{name}'.)nameold_name)r   	getLoggerr$   r!   warningswarnformatdebugr   setLevelDEBUGr   
addHandlerdefault_handler)appr   r%   
old_loggers       r   create_loggerr1   J   s     sx((F + 
 
&x00
z"" 	;v+>+> 	M0 17CHx0X0X	   E
y ' '&&&V$$ +/***Mr   )__doc__
__future__r   r   r	   r'   werkzeug.localr   globalsr   r   r   StreamHandlerr.   setFormatter	Formatterr!   r1   r   r   r   <module>r9      s     ' & & & & &  



  % % % % % %       	E 	E 	E  * (''(:;;   GNOO  
  # # # # #r   