ok

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clcommon/__pycache__/cllog.cpython-37.pyc

B

E!wd��@sVddlmZddlmZddlmZddlZddlZddlZddlZGdd�d�ZdS)�)�absolute_import)�division)�print_functionNc@s*eZdZdd�Zd	dd�Zedd��ZdS)
�
ClAuditLogcCs
||_dS)N)�_log_file_name)�selfZ
log_file_name�r�?/opt/alt/python37/lib/python3.7/site-packages/clcommon/cllog.py�__init__szClAuditLog.__init__�c	Cs�tj��}t��}|�|�}yrt|jd�}t�|tj	tj
B�|�|�d�d|dt
|�dt
tjdd��d|d�|��Wnttfk
r�YnXdS)	N�az%Y.%m.%d %H:%M:%Sz: Parent process: z (PID: z	): Args: �� �
)�datetimeZnow�os�getppid�_get_process_name�openr�fcntl�lockfZLOCK_EXZLOCK_NB�writeZstrftime�str�sys�argv�close�IOError�OSError)r�msgZdt_nowZparent_proc_idZ	proc_nameZaudit_log_filerrr	�info_log_writes

BzClAuditLog.info_log_writecCsRd}y<td|d�}|���d�d�dd��dd�}|��WnYnX|S)	z\
		Get process name by pid
		:param pid: PID for get process name
		:return: process name
		z	<Unknown>z
/proc/%s/stat�rrr
�(r�))r�read�split�replacer)�pid�name�frrr	r*s"zClAuditLog._get_process_nameN)r)�__name__�
__module__�__qualname__r
r�staticmethodrrrrr	rs
r)	Z
__future__rrrrrrrrrrrr	�<module>	s

Zerion Mini Shell 1.0