HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux mail.btech-izolacje.pl 5.15.0-140-generic #150-Ubuntu SMP Sat Apr 12 06:00:09 UTC 2025 x86_64
User: pewna6876 (1017)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/landscape/lib/__pycache__/logging.cpython-310.pyc
o

���c�	�@sZddlmZddlZddlZddlZddlZdZddd�Zddd	�Zdd
d�Z	dd
�Z
dS)�)�absolute_importNz;%(asctime)s %(levelname)-8s [%(threadName)-10s] %(message)s�infocCsR|jdddddd�d}|r|d�|�7}|jd	d
d||d�|jd
|dd�dS)z?Add common logging-related CLI options to the given arg parser.z-qz--quietF�
store_truez"Do not log to the standard output.)�default�action�helpz)The directory in which to write log filesz (default: {!r}).z-lz	--log-dir�FILE)�metavarrrz--log-levelz/One of debug, info, warning, error or critical.)rrN)�
add_option�format)�parser�level�logdir�
logdirhelp�r�7/usr/lib/python3/dist-packages/landscape/lib/logging.py�add_cli_optionss��
�rFcCsV|dur
tj�tjd�}t�|���}tt�	�|||t�
t�|s$tjnd�t�	�S)z3Given a log dir, set up logging for an application.Nr)
�os�path�basename�sys�argv�logging�getLevelName�upper�
_init_logging�	getLogger�	Formatter�FORMAT�stdout)rr
�progname�quietrrr�init_app_loggings�r"c	Cst|�|�tj�|�st�|�tj�||d�}t�|�g}|r)|�t�	|��|D]}|�
|�|�|�q+dS)Nz.log)�setLevelrr�exists�makedirs�joinr�FileHandler�append�
StreamHandler�
addHandler�setFormatter)	�loggerr
r�logname�	formatterr�filename�handlers�handlerrrrr+s

�
�rc	Csdt��jD]%}t|tj�r*|��z|j��t|j	|j
�|_W|��q|��wqt�d�dS)z�
    This closes and reopens the underlying files in the logging module's
    root logger. If called after logrotate (or something similar) has
    moved the old log file out of the way, this will start writing to a new
    new log file...
    zLandscape Logs rotatedN)
rrr0�
isinstancer'�acquire�stream�close�open�baseFilename�mode�releaser)r1rrr�rotate_logs?s
��r:)rN)rNF)N)�
__future__rrr�os.pathrrrr"rr:rrrr�<module>s