o
    /i                     @   s   d dl Z d dlZd dlZd dlmZmZ dadZg dZde	fddZ
d	d
 Zddee dee fddZdd ZddefddZG dd de jZdS )    N)ListOptionalFgoogle)httpRequestrpcNameserviceNamecredentialsTypecredentialsInfouniverseDomainrequestresponsemetadataretryAttempthttpResponsereturnc                 C   s   | j g kp| jtjkp| j S )zDetermines whether `logger` has non-default configuration

    Args:
      logger: The logger to check.

    Returns:
      bool: Whether the logger has any non-default configuration.
    )handlerslevelloggingNOTSET	propagate)logger r   R/var/www/passon-env/lib/python3.10/site-packages/google/api_core/client_logging.pylogger_configured   s   
r   c                  C   s$   t rdS tdd} t|  da dS )aX  Initializes "google" loggers, partly based on the environment variable

    Initializes the "google" logger and any loggers (at the "google"
    level or lower) specified by the environment variable
    GOOGLE_SDK_PYTHON_LOGGING_SCOPE, as long as none of these loggers
    were previously configured. If any such loggers (including the
    "google" logger) are initialized, they are set to NOT propagate
    log events up to their parent loggers.

    This initialization is executed only once, and hence the
    environment variable is only processed the first time this
    function is called.
    NGOOGLE_SDK_PYTHON_LOGGING_SCOPE T)_LOGGING_INITIALIZEDosgetenvsetup_logging)scopesr   r   r   initialize_logging*   s
   r!   r    c                 C   s   | sg S | g}|S )aO  Returns a list of logger names.

    Splits the single string of comma-separated logger names into a list of individual logger name strings.

    Args:
      scopes: The name of a single logger. (In the future, this will be a comma-separated list of multiple loggers.)

    Returns:
      A list of all the logger names in scopes.
    r   )r    
namespacesr   r   r   parse_logging_scopes@   s   r#   c                 C   sB   t | st }| d d| _t }|| | | dS dS )z6Configures `logger` to emit structured info to stdout.DEBUGFN)r   r   StreamHandlersetLevelr   StructuredLogFormattersetFormatter
addHandler)r   console_handler	formatterr   r   r   configure_defaultsT   s   

r,   r   c                 C   sD   t | }|D ]}t|}t| qtt}t|s d|_dS dS )aV  Sets up logging for the specified `scopes`.

    If the loggers specified in `scopes` have not been previously
    configured, this will configure them to emit structured log
    entries to stdout, and to not propagate their log events to their
    parent loggers. Additionally, if the "google" logger (whether it
    was specified in `scopes` or not) was not previously configured,
    it will also configure it to not propagate log events to the root
    logger.

    Args:
      scopes: The name of a single logger. (In the future, this will be a comma-separated list of multiple loggers.)

    FN)r#   r   	getLoggerr,   _BASE_LOGGER_NAMEr   r   )r    logger_names	namespacer   base_loggerr   r   r   r   _   s   



r   c                   @   s   e Zd ZdejfddZdS )r'   recordc                 C   sL   |  ||j|j| d}tD ]}t||d }|d ur |||< qt|S )N)	timestampseveritynamemessage)
formatTime	levelnamer5   
getMessage_recognized_logging_fieldsgetattrjsondumps)selfr2   log_obj
field_namevaluer   r   r   format   s   
zStructuredLogFormatter.formatN)__name__
__module____qualname__r   	LogRecordrB   r   r   r   r   r'      s    r'   )N)r   )r   r<   r   typingr   r   r   r.   r:   boolr   r!   strr#   r,   r   	Formatterr'   r   r   r   r   <module>   s    "