One Hat Cyber Team
Your IP :
3.135.198.165
Server IP :
192.145.235.60
Server :
Linux ngx365.inmotionhosting.com 5.14.0-427.33.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 30 09:45:56 EDT 2024 x86_64
Server Software :
Apache
PHP Version :
8.2.27
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
saltstack
/
salt
/
extras-3.10
/
rads
/
__pycache__
/
Edit File:
_logging.cpython-310.pyc
o �<�f: � @ sZ d Z ddlmZmZmZ ddlZddlZddlmZ ddl Z ddl mZ ddlm Z mZ ddd d e jddddf deeedf deedf d edededeeef deeed df deeedf deeeef df deedf de jfdd�Zde_ d#deeef deedf deedf fdd�Zde_G dd � d e j�ZG d!d"� d"e j�ZdS )$zRads logging functions� )�Literal�Union�ION)�Path)�WatchedFileHandler� )�red�yellowz%%(asctime)s %(levelname)s %(message)sz%Y-%m-%d %H:%M:%ST�path�name�fmt�datefmt� multiline�loglevel� print_out)�stdout�stderr�print_loglevel�chown�chmod�returnc C s� t |t�rtt|�� �}t |t�sJ �t |t�r&tt|�� �}t |t�s&J �t |t�rC|�� dkr5tj}n|�� dkr?tj }nt |��| rWt| �} | j| du rQdn| dd� n|s]t d��| durm| sgt d��t �| | � |dur�t |t�szt d ��| s�t d ��t �| |d |d � t�|�} |r�t||d �}ntj||d �}| r�t| �}|�|� |�|� | �|� |r�tj|d�} | �|� | �|p�|� | �| � |g}|dur�|�|� | �t|�� | S )a Sets up and returns the root logger, or a named logger if ``name`` is set Args: path: file path to log to. If set to None, print_out must not be None. name: logger name for logging.getLogger() fmt: format for ``logging.Formatter`` datefmt: date format for ``logging.Formatter`` multiline: whether to support multiline logging loglevel: loglevel for logging.setLevel - will accept a constant from the logging module such as logging.INFO, or the string of the level name, e.g. 'INFO' print_out: set this to ``sys.stdout`` or ``sys.stderr`` to also print there. Also accepts 'stdout' or 'stderr' as literal str print_loglevel: optional separate log level for the ``print_out`` kwarg. If unset, it will use the ``loglevel`` kwarg. chown: ensure ownership of the log path Only valid if path is set. chmod: ensure perms of the log path *in octal*. Only valid if path is set. r r Ni� T)�mode�exist_okz5At least one of 'path' and/or 'print_out' must be setz!'path' must be set to use 'chmod'z'chown' must be a tuplez!'path' must be set to use 'chown'r r )r r ��stream)� isinstance�str�getattr�logging�upper�int�lower�sysr r � TypeErrorr �touch�osr �tupler � getLogger�MultilineFormatter� Formatterr �setFormatter�setLevel� addHandler� StreamHandler�append�min)r r r r r r r r r r �logger� formatterZmain_handlerZ print_handlerZlevels� r2 �0/opt/saltstack/salt/extras-3.10/rads/_logging.py� setup_logging s\ r4 �rads�DEBUG�rads_verbosity�colorc C s< t | t�rtt| �� �} t | t�sJ �t�|�}tjtj d�}|� tjdd�� |�t tjtj�� |du rAttjd�o@tj �� }|rTtjtd�d�}tjtd�d�}ntjdd� }}tjtjd�}|� |� |�t tjtj�� tjtjd�}|� |� |�t tjtj�� |�|� |�|� |�|� |�| � |S )a~ Return a custom logger used to easily handle error and message printing. debug & info: prints to stdout warning: prints to stderr (in yellow, if enabled) error & critical: prints to stderr (in red, if enabled) Args: loglevel: filter to only print up to this level. This is especially useful to add --verbose/--quiet behavior color: set this True or False to force colors on or off. If unset, it will check if stderr is a TTY and enable colors if so name: name of the logger for logging.getLogger() Returns: Logger: the configured Logger object r z%(message)s)r N�isatty)r r r r r r r'