Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/uaclient/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/uaclient/__pycache__/log.cpython-310.pyc
o

��pf��@s�ddlZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
ddlmZm
Z
mZmZddlmZGdd�dej�ZGdd	�d	ej�ZGd
d�dej�Zdefd
d�Zdefdd�Zde	efdd�Zdd�Zde
eefdefdd�ZdS)�N)�OrderedDict)�Any�Dict�List�Union)�defaults�secret_manager�system�util)�UAConfigc@� eZdZdZdejfdd�ZdS)�RegexRedactionFilter�,A logging filter to redact confidential info�recordcCst�t|j��|_dS�NT)r
�redact_sensitive_logs�str�msg��selfr�r�./usr/lib/python3/dist-packages/uaclient/log.py�filterszRegexRedactionFilter.filterN��__name__�
__module__�__qualname__�__doc__�logging�	LogRecordrrrrrr
�r
c@r)�KnownSecretRedactionFilterrrcCstj�t|j��|_dSr)r�secrets�redact_secretsrrrrrrrsz!KnownSecretRedactionFilter.filterNrrrrrr!r r!c@s0eZdZdZdZdZdZdejde	fdd�Z
d	S)
�JsonArrayFormatterzYJson Array Formatter for our logging mechanism
    Custom made for Pro logging needs
    z%Y-%m-%dT%H:%M:%Sz%s.%03d)�asctime�	levelname�name�funcName�lineno�messager�returncCs�|��|_|�|�|_i}|jr|�|j�|d<|�d�s%|jr%|j|d<|jr0|�	|j�|d<|j
�d�}|rBt|t�rB|�
|�t�}|jD]}|j
�|�}|||<qH||d<t�t|����S)N�exc_info�
stack_info�extra)�
getMessager*�
formatTimer%r,�formatException�get�exc_textr-�formatStack�__dict__�
isinstance�dict�updater�required_fields�json�dumps�list�values)rr�extra_message_dictr.�local_log_record�field�valuerrr�format,s,
�
�


zJsonArrayFormatter.formatN)rrrr�default_time_format�default_msec_formatr9rrrrBrrrrr$s	r$r+cCst��rt�jSt�S)z\
    Gets the correct log_file path,
    adjusting for whether the user is root or not.
    )r
�we_are_currently_rootr�log_file�get_user_log_filerrrr�get_user_or_root_log_file_pathJsrHcCstj�t��d�S)z/Gets the correct user log_file storage location�ubuntu-pro.log)�os�path�joinr	�get_user_cache_dirrrrrrGUsrGcCsHt�d�}g}|D]}tj�d|dtjd�}tj�|�r!|�|�q	|S)z|Gets all the log files for the users in the system

    Returns a list of all user log files in their home directories.
    z/homez.cacherI)rJ�listdirrKrLr�USER_CACHE_SUBDIR�isfile�append)�user_directories�	log_files�user_directory�	user_pathrrr�get_all_user_log_filesZs
�
�rVcCs\t�d�}|�tj�t��}|�t��|�tj�|�t��|�t	��|�
|�dS)N�	ubuntupro)r�	getLogger�setLevel�INFO�
StreamHandler�setFormatterr$�	addFilterr
r!�
addHandler)�logger�console_handlerrrr�setup_journald_loggingns
ra�	log_levelrFcCs�t|t�r	|��}t��st�}t�d�}|�|�g|_	t
�|�}|��s4|j
jddd�|jdd�t�|�}|�t��|�|�|�t��|�t��|�|�dS)zoSetup logging to log_file

    If run as non-root then log_file is replaced with a user-specific log file.
    rWT)�parents�exist_oki�)�modeN)r6r�upperr
rErGrrXrY�handlers�pathlib�Path�exists�parent�mkdir�touch�FileHandlerr\r$r]r
r!r^)rbrFr_�
log_file_path�file_handlerrrr�setup_cli_loggingys"





rq)r:rrJrh�collectionsr�typingrrrr�uaclientrrr	r
�uaclient.configr�Filterr
r!�	Formatterr$rrHrGrVra�intrqrrrr�<module>s .

Spamworldpro Mini