o
    :n0j[                     @   s   d Z ddlZddlZddlZddlZddlZddlZddlmZ da	e
 ZejfddZeddd	Zd
d Zdd Zdd ZdZdd Zdd Ze  dS )zLogging functions.    N   )configurationc                 C   sP   t tjat j| d}dtj d}|t | t| t	t j
 dS )zpInitialize the global logger. All log messages will be
    sent to the given stream, default is sys.stderr.
    )streamz%(levelname)s z: %(message)sN)logging	getLoggerr   AppNameloggerStreamHandlersetFormatter	Formatter
addHandlersetLevelINFO)r   handlerformat r   S/home/wildlama/miniconda3/envs/lam_a2e/lib/python3.10/site-packages/patoolib/log.pyinit_logging   s   
r   encodingc                    s   d  fdd|D S )zReplacing unknown characters in args for the given encoding.
    @return: a space-separated string that will not have encoding errors
    with the given encoding
     c                    s$   g | ]}t |j d d qS )replace)errors)strencodedecode).0argr   r   r   
<listcomp>2   s   $ zencode_safe.<locals>.<listcomp>)join)r   argsr   r   r   encode_safe,   s   r!   c                 C      t t|  dS )zLog error message.N)r   errorr!   msgr   r   r   	log_error6      r&   c                 C   r"   )zLog warning message.N)r   warningr!   r$   r   r   r   log_warning;   r'   r)   c                 C   r"   )zLog info message.N)r   infor!   r$   r   r   r   log_info@   r'   r+   )LANGUAGELC_ALLLC_CTYPELANGc                  C   s   t  } tjdd tD }ttdt	j
 dt	j dt	j dtj dtj dt  d	t|  d
tj d| dt	j
 d dS )zPrint internal error message.c                 S   s.   g | ]}t |d ur| dt |qS )N=)osgetenv)r   keyr   r   r   r   M   s   . z&log_internal_error.<locals>.<listcomp>zT********** Oops, I did it again. *************

You have found an internal error in z.
Please write a bug report at
z
and include at least the information below:

Not disclosing some of the information below due to privacy reasons is ok.
I will try to help you nonetheless, but you have to give me something
I can work with ;) .

z
Python z on z
Platform: z
Local time: z
sys.orig_argv: z
Environment:
z

******** z' internal error, over and out ********
N)time	localtimer1   linesepr   EnvKeysr   	exceptionr!   r   r   Z
SupportUrlZAppsysversionplatformstrtime	orig_argv)nowenvr   r   r   log_internal_errorI   s:   r@   c                 C   s   t d| S )zReturn ISO 8601 formatted time.z%Y-%m-%d %H:%M:%S%z)r4   strftime)tr   r   r   r<   i   s   r<   )__doc__r1   r9   r4   localer   r;    r   r   getpreferredencodingZdefault_encodingstderrr   r!   r&   r)   r+   r7   r@   r<   r   r   r   r   <module>   s&   
 
