Current File : //proc/self/root/lib/python3/dist-packages/twisted/logger/__pycache__/_global.cpython-312.pyc |
�
Ϫ�f�! � � � d Z ddlZddlZddlmZmZmZmZmZ ddl m
Z
ddlmZ ddl
mZ ddlmZ dd lmZmZ dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ dZ G d� d� Z! e� Z" e!e"ejF ee� Z$y)z�
This module includes process-global state associated with the logging system,
and implementation of logic for managing that global state.
� N)�IO�Any�Iterable�Optional�Type)�currentframe)�qual� )�LimitedHistoryLogObserver)�FileLogObserver)�FilteringLogObserver�LogLevelFilterPredicate��eventAsText)�ILogObserver)�LoggingFile)�LogLevel)�Logger)�LogPublisherz�Warning: primary log target selected twice at <{fileNow}:{lineNow}> - previously selected at <{fileThen}:{lineThen}>. Remove one of the calls to beginLoggingTo.c � � e Zd ZdZdZ ddedee dedede e
d dfd
�Z ddee
ded
ed dfd�Z ddedee dede
de ee de e d dfd�Zy)�LogBeginnera�
A L{LogBeginner} holds state related to logging before logging has begun,
and begins logging when told to do so. Logging "begins" when someone has
selected a set of observers, like, for example, a L{FileLogObserver} that
writes to a file on disk, or to standard output.
Applications will not typically need to instantiate this class, except
those which intend to initialize the global logging system themselves,
which may wish to instantiate this for testing. The global instance for
the current process is exposed as
L{twisted.logger.globalLogBeginner}.
Before logging has begun, a L{LogBeginner} will:
1. Log any critical messages (e.g.: unhandled exceptions) to the given
file-like object.
2. Save (a limited number of) log events in a
L{LimitedHistoryLogObserver}.
@cvar _DEFAULT_BUFFER_SIZE: The default size for the initial log events
buffer.
@ivar _initialBuffer: A buffer of messages logged before logging began.
@ivar _publisher: The log publisher passed in to L{LogBeginner}'s
constructor.
@ivar _log: The logger used to log messages about the operation of the
L{LogBeginner} itself.
@ivar _stdio: An object with C{stderr} and C{stdout} attributes (like the
L{sys} module) which will be replaced when redirecting standard I/O.
@ivar _temporaryObserver: If not L{None}, an L{ILogObserver} that observes
events on C{_publisher} for this L{LogBeginner}.
�� N� publisher�errorStream�stdio�warningsModule�initialBufferSize�returnc � � |�| j }t |�� | _ || _ t |�� | _ || _ || _ t | j t t |d� � t t j �� g� � | _ d| _ |j! | j � |j"