|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /lib/python3/dist-packages/certbot/__pycache__/ |
Upload File : |
U
�]�1 � @ s d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddl
mZ ddlm
Z
ddlmZ ddlmZ ddlmZ d Zd
Ze�e�Zdd� Zd
d� Zdd� ZG dd� dej�ZG dd� dejj�ZG dd� dej�Zdd� Zdd� Z dd� Z!dS )a� Logging utilities for Certbot.
The best way to use this module is through `pre_arg_parse_setup` and
`post_arg_parse_setup`. `pre_arg_parse_setup` configures a minimal
terminal logger and ensures a detailed log is written to a secure
temporary file if Certbot exits before `post_arg_parse_setup` is called.
`post_arg_parse_setup` relies on the parsed command line arguments and
does the full logging setup with terminal and rotating file handling as
configured by the user. Any logged messages before
`post_arg_parse_setup` is called are sent to the rotating file handler.
Special care is taken by both methods to ensure all errors are logged
and properly flushed before program exit.
� )�print_functionN)�messages)� constants)�errors)�util)�osz%(message)sz.%(asctime)s:%(levelname)s:%(name)s:%(message)sc C s� t � } | �t�t�� | �tj� t| �}t� }|�t�t �� |�t
j� t�� }|�tj� |�
|� |�
|� t�tj� tjt|dtjk| jd�t_dS )a� Setup logging before command line arguments are parsed.
Terminal logging is setup using
`certbot.constants.QUIET_LOGGING_LEVEL` so Certbot is as quiet as
possible. File logging is setup so that logging messages are
buffered in memory. If Certbot exits before `post_arg_parse_setup`
is called, these buffered messages are written to a temporary file.
If Certbot doesn't exit, `post_arg_parse_setup` writes the messages
to the normal log files.
This function also sets `logging.shutdown` to be called on program
exit which automatically flushes logging handlers and
`sys.excepthook` to properly log/display fatal exceptions.
z--debug��debug�log_pathN)�TempHandler�setFormatter�logging� Formatter�FILE_FMT�setLevel�DEBUG�
MemoryHandler�ColoredStreamHandler�CLI_FMTr �QUIET_LOGGING_LEVEL� getLogger�
addHandlerr Zatexit_registerZshutdown� functools�partial�pre_arg_parse_except_hook�sys�argv�path�
excepthook)�temp_handler�memory_handlerZstream_handler�root_logger� r"