
    ,h@~                       S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	J
r
  SSKJrJrJr  SSKJrJr  SSKJr  SSKJrJr  SSKJr  S	S
KJrJrJrJr  S	SKJr  S	SKJ r   S	SK!J"r"  S	SK#J$r$  S	SK%J&r&  S	SK'J(r(  S	SK)J*r*  S	SK+J,r,  S	SK-J.r.  S	SK/J0r0J1r1J2r2J3r3J4r4  S	SK5J6r6J7r7J8r8J9r9  \Rt                  S:  a  SSK;J<r<  OSSK=J>r<  \
" S/ SQ5      r?\$" 5       r@\"" S0 S9rA " S S5      rB " S S 5      rCg)!a  Core logging functionalities of the `Loguru` library.

.. References and links rendered by Sphinx are kept here as "module documentation" so that they can
   be used in the ``Logger`` docstrings but do not pollute ``help(logger)`` output.

.. |Logger| replace:: :class:`~Logger`
.. |add| replace:: :meth:`~Logger.add()`
.. |remove| replace:: :meth:`~Logger.remove()`
.. |complete| replace:: :meth:`~Logger.complete()`
.. |catch| replace:: :meth:`~Logger.catch()`
.. |bind| replace:: :meth:`~Logger.bind()`
.. |contextualize| replace:: :meth:`~Logger.contextualize()`
.. |patch| replace:: :meth:`~Logger.patch()`
.. |opt| replace:: :meth:`~Logger.opt()`
.. |log| replace:: :meth:`~Logger.log()`
.. |level| replace:: :meth:`~Logger.level()`
.. |enable| replace:: :meth:`~Logger.enable()`
.. |disable| replace:: :meth:`~Logger.disable()`

.. |Any| replace:: :obj:`~typing.Any`
.. |str| replace:: :class:`str`
.. |int| replace:: :class:`int`
.. |bool| replace:: :class:`bool`
.. |tuple| replace:: :class:`tuple`
.. |namedtuple| replace:: :func:`namedtuple<collections.namedtuple>`
.. |list| replace:: :class:`list`
.. |dict| replace:: :class:`dict`
.. |str.format| replace:: :meth:`str.format()`
.. |Path| replace:: :class:`pathlib.Path`
.. |match.groupdict| replace:: :meth:`re.Match.groupdict()`
.. |Handler| replace:: :class:`logging.Handler`
.. |sys.stderr| replace:: :data:`sys.stderr`
.. |sys.exc_info| replace:: :func:`sys.exc_info()`
.. |time| replace:: :class:`datetime.time`
.. |datetime| replace:: :class:`datetime.datetime`
.. |timedelta| replace:: :class:`datetime.timedelta`
.. |open| replace:: :func:`open()`
.. |logging| replace:: :mod:`logging`
.. |signal| replace:: :mod:`signal`
.. |contextvars| replace:: :mod:`contextvars`
.. |multiprocessing| replace:: :mod:`multiprocessing`
.. |Thread.run| replace:: :meth:`Thread.run()<threading.Thread.run()>`
.. |Exception| replace:: :class:`Exception`
.. |AbstractEventLoop| replace:: :class:`AbstractEventLoop<asyncio.AbstractEventLoop>`
.. |asyncio.get_running_loop| replace:: :func:`asyncio.get_running_loop()`
.. |asyncio.run| replace:: :func:`asyncio.run()`
.. |loop.run_until_complete| replace::
    :meth:`loop.run_until_complete()<asyncio.loop.run_until_complete()>`
.. |loop.create_task| replace:: :meth:`loop.create_task()<asyncio.loop.create_task()>`

.. |logger.trace| replace:: :meth:`logger.trace()<Logger.trace()>`
.. |logger.debug| replace:: :meth:`logger.debug()<Logger.debug()>`
.. |logger.info| replace:: :meth:`logger.info()<Logger.info()>`
.. |logger.success| replace:: :meth:`logger.success()<Logger.success()>`
.. |logger.warning| replace:: :meth:`logger.warning()<Logger.warning()>`
.. |logger.error| replace:: :meth:`logger.error()<Logger.error()>`
.. |logger.critical| replace:: :meth:`logger.critical()<Logger.critical()>`

.. |file-like object| replace:: ``file-like object``
.. _file-like object: https://docs.python.org/3/glossary.html#term-file-object
.. |callable| replace:: ``callable``
.. _callable: https://docs.python.org/3/library/functions.html#callable
.. |coroutine function| replace:: ``coroutine function``
.. _coroutine function: https://docs.python.org/3/glossary.html#term-coroutine-function
.. |re.Pattern| replace:: ``re.Pattern``
.. _re.Pattern: https://docs.python.org/3/library/re.html#re-objects
.. |multiprocessing.Context| replace:: ``multiprocessing.Context``
.. _multiprocessing.Context:
   https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

.. |better_exceptions| replace:: ``better_exceptions``
.. _better_exceptions: https://github.com/Qix-/better-exceptions

.. |loguru-config| replace:: ``loguru-config``
.. _loguru-config: https://github.com/erezinman/loguru-config

.. _Pendulum: https://pendulum.eustace.io/docs/#tokens

.. _@Qix-: https://github.com/Qix-
.. _@erezinman: https://github.com/erezinman
.. _@sdispater: https://github.com/sdispater

.. _formatting directives: https://docs.python.org/3/library/string.html#format-string-syntax
.. _reentrant: https://en.wikipedia.org/wiki/Reentrancy_(computing)
    N)
namedtuple)isclassiscoroutinefunctionisgeneratorfunction)current_processget_context)BaseContext)basenamesplitext)current_thread   )_asyncio_loop	_colorama	_defaults_filters)ExceptionFormatter)	Colorizer)
ContextVar)	aware_now)ErrorInterceptor)FileSink)	get_frame)Handler)create_logger_lock)RecordException
RecordFileRecordLevelRecordProcessRecordThread)	AsyncSinkCallableSinkStandardSink
StreamSink)      )PathLike)PurePathLevel)namenocoloriconloguru_contextdefaultc                   &    \ rS rSrS rS rS rSrg)Core   c                    [        S[        R                  [        R                  [        R                  5      [        S[        R
                  [        R                  [        R                  5      [        S[        R                  [        R                  [        R                  5      [        S[        R                  [        R                  [        R                  5      [        S[        R                  [        R                  [        R                   5      [        S[        R"                  [        R$                  [        R&                  5      [        S[        R(                  [        R*                  [        R,                  5      /nU Vs0 s H  o"R.                  U_M     snU l        0 U R0                  R3                  5        VVs0 s H&  u  p2U[4        R6                  " UR8                  5      _M(     snnES S0EU l        U R0                  R3                  5        VVs0 s H  u  p2X3X2R<                  UR>                  4_M      snnU l         S	U l!        0 U l"        0 U l#        S U l$        [K        S
5      U l&        0 U l'        / U l(        SU l)        [T        RV                  " 5       U l,        [[        5       U l.        g s  snf s  snnf s  snnf )NTRACEDEBUGINFOSUCCESSWARNINGERRORCRITICAL r   infT)/r(   r   LOGURU_TRACE_NOLOGURU_TRACE_COLORLOGURU_TRACE_ICONLOGURU_DEBUG_NOLOGURU_DEBUG_COLORLOGURU_DEBUG_ICONLOGURU_INFO_NOLOGURU_INFO_COLORLOGURU_INFO_ICONLOGURU_SUCCESS_NOLOGURU_SUCCESS_COLORLOGURU_SUCCESS_ICONLOGURU_WARNING_NOLOGURU_WARNING_COLORLOGURU_WARNING_ICONLOGURU_ERROR_NOLOGURU_ERROR_COLORLOGURU_ERROR_ICONLOGURU_CRITICAL_NOLOGURU_CRITICAL_COLORLOGURU_CRITICAL_ICONr)   levelsitemsr   ansifyr+   levels_ansi_codesr*   r,   levels_lookuphandlers_counthandlersextrapatcherfloat	min_levelenabledactivation_listactivation_none	threadinglocalthread_localsr   lock)selfrR   levelr)   s       aC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\loguru/_logger.py__init__Core.__init__   s9   )),,++	 )),,++	 ((++**	 ++..--	 ++..--	 )),,++	 ,,//..	K+
X 7==fUzz5(f="
FJkkFWFWFYZFY{ttY%%ekk22FYZ"
""
 IMHYHYH[
H[Dxx44H[
  
u!#&__.&(	3 >Z
s   J5-J:%K c                 N    U R                   R                  5       nS US'   S US'   U$ )Nrb   rc   )__dict__copyrd   states     rf   __getstate__Core.__getstate__   s,    ""$!%of    c                     U R                   R                  U5        [        R                  " 5       U l        [        5       U l        g N)rj   updater`   ra   rb   r   rc   rl   s     rf   __setstate__Core.__setstate__   s-    U#&__.&(	rp   )r^   r_   r]   rY   rX   rW   rR   rU   rV   rc   r\   rZ   rb   N)__name__
__module____qualname____firstlineno__rg   rn   rt   __static_attributes__ rp   rf   r1   r1      s    F)P)rp   r1   c                   *   \ rS rSrSrS rS r\R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                   \R"                  S.
S jrS-S jrS	 r\4S
SSSSSS.S jjrSSSSSSSSS.S jrS r\R4                  S 5       rS rS.S jrS rS rSSSSSS.S jr S r!\"0 SS.S j5       r#\"S 5       r$S  r%S! r&S" r'S# r(S$ r)S% r*S& r+S' r,S( r-S) r.S* r/S+ r0S,r1g)/Logger   a  An object to dispatch logging messages to configured handlers.

The |Logger| is the core object of ``loguru``, every logging configuration and usage pass
through a call to one of its methods. There is only one logger, so there is no need to retrieve
one before usage.

Once the ``logger`` is imported, it can be used to write messages about events happening in your
code. By reading the output logs of your application, you gain a better understanding of the
flow of your program and you more easily track and debug unexpected behaviors.

Handlers to which the logger sends log messages are added using the |add| method. Note that you
can use the |Logger| right after import as it comes pre-configured (logs are emitted to
|sys.stderr| by default). Messages can be logged with different severity levels and they can be
formatted using curly braces (it uses |str.format| under the hood).

When a message is logged, a "record" is associated with it. This record is a dict which contains
information about the logging context: time, function, file, line, thread, level... It also
contains the ``__name__`` of the module, this is why you don't need named loggers.

You should not instantiate a |Logger| by yourself, use ``from loguru import logger`` instead.
c           	      (    Xl         X#XEXgXU
4	U l        g rr   _core_options)rd   core	exceptiondepthrecordlazycolorsrawcapturepatchersrY   s              rf   rg   Logger.__init__   s    
"6gY^_rp   c                 b    S[        U R                  R                  R                  5       5      -  $ )Nz<loguru.logger handlers=%r>)listr   rX   valuesrd   s    rf   __repr__Logger.__repr__   s%    ,tDJJ4G4G4N4N4P/QQQrp   )
re   formatfiltercolorize	serialize	backtracediagnoseenqueuecontextcatchc       
            U R                   R                     U R                   R                  nU R                   =R                  S-  sl        SSS5        [        UW5      nUc	  U(       a  Sn[	        U[
        [        45      (       a,  UnSU-  nUc  Sn[        U40 UD6n0 nUR                  nSnSnGO![        US5      (       a  [        UR                  5      (       a  [        USS5      =(       d    [        U5      nUc  [        R                  " U5      nUS	L a2  [        R                   " U5      (       a  [        R"                  " U5      nOUn[%        U5      n[        US
S5      nSnSnGOg[	        U[&        R(                  5      (       a.  [        U5      nUc  Sn[+        U5      n[        US
S5      nSnSnGO[-        U5      (       d  [-        [        USS5      5      (       a  [        USS5      =(       d    [        U5      nUc  SnUR/                  SS5      nU	(       a  Uc   [0        R2                  " 5       n[-        U5      (       a  UOUR8                  n[;        UUU5      nSnSnSnOg[        U5      (       a6  [        USS5      =(       d    [        U5      nUc  Sn[=        U5      nSnSnSnO![?        S[A        U5      RB                  -  5      eU(       a   [?        S[E        [G        U5      5      -  5      eUc  SnGOUS:X  a  [H        RJ                  nGO[	        U[
        5      (       a6  US-   n[M        U5      n[N        RP                  " [H        RR                  UUS9nGO~[	        U[T        5      (       Ga  0 nURW                  5        H  u  nnUb6  [	        U[
        5      (       d!  [?        S[A        U5      RB                  -  5      eUSL a  SnOyUS	L a  SnOq[	        U[
        5      (       a   U RY                  U5      RZ                  nO?[	        U[\        5      (       a  UnO'[?        SU< S[A        U5      RB                  < S35      eUS:  a  [7        SUU4-  5      eUUU'   M     [N        RP                  " [H        R^                  US9nOS[        U5      (       a"  U[`        Rb                  :X  a  [7        S5      eUnO![?        S[A        U5      RB                  -  5      e[	        U[
        5      (       a  U RY                  U5      RZ                  n O9[	        U[\        5      (       a  Un O![?        S[A        U5      RB                  -  5      eU S:  a  [7        SU -  5      e[	        U[
        5      (       a    [d        Rf                  " UU-   S -   5      n!Sn"OU[        U5      (       a$  U[`        Rh                  :X  a  [7        S"5      eUn!S	n"O![?        S#[A        U5      RB                  -  5      e[	        U[
        5      (       d  S$n[	        U
[
        5      (       a  [k        U
5      n
O9U
b6  [	        U
[l        5      (       d!  [?        S%[A        U
5      RB                  -  5      eU R                   R                     [o        UUUUU Rp                  Rr                  Rt                  US&9n#[)        UUU U!U"UUUU	U
UUU#U R                   Rv                  S'9n$U R                   Rx                  R{                  5       n%U$U%U'   [}        U R                   R~                  U 5      U R                   l?        U%U R                   l<        SSS5        U$ ! , (       d  f       GN= f! [4         a  n[7        S5      UeSnAff = f! [6         a    [7        SU< SU< S35      Sef = f! [6         a  n[7        S!5      UeSnAff = f! , (       d  f       U$ = f)(uv  Add a handler sending log messages to a sink adequately configured.

Parameters
----------
sink : |file-like object|_, |str|, |Path|, |callable|_, |coroutine function|_ or |Handler|
    An object in charge of receiving formatted logging messages and propagating them to an
    appropriate endpoint.
level : |int| or |str|, optional
    The minimum severity level from which logged messages should be sent to the sink.
format : |str| or |callable|_, optional
    The template used to format logged messages before being sent to the sink.
filter : |callable|_, |str| or |dict|, optional
    A directive optionally used to decide for each logged message whether it should be sent
    to the sink or not.
colorize : |bool|, optional
    Whether the color markups contained in the formatted message should be converted to ansi
    codes for terminal coloration, or stripped otherwise. If ``None``, the choice is
    automatically made based on the sink being a tty or not.
serialize : |bool|, optional
    Whether the logged message and its records should be first converted to a JSON string
    before being sent to the sink.
backtrace : |bool|, optional
    Whether the exception trace formatted should be extended upward, beyond the catching
    point, to show the full stacktrace which generated the error.
diagnose : |bool|, optional
    Whether the exception trace should display the variables values to eases the debugging.
    This should be set to ``False`` in production to avoid leaking sensitive data.
enqueue : |bool|, optional
    Whether the messages to be logged should first pass through a multiprocessing-safe queue
    before reaching the sink. This is useful while logging to a file through multiple
    processes. This also has the advantage of making logging calls non-blocking.
context : |multiprocessing.Context| or |str|, optional
    A context object or name that will be used for all tasks involving internally the
    |multiprocessing| module, in particular when ``enqueue=True``. If ``None``, the default
    context is used.
catch : |bool|, optional
    Whether errors occurring while sink handles logs messages should be automatically
    caught. If ``True``, an exception message is displayed on |sys.stderr| but the exception
    is not propagated to the caller, preventing your app to crash.
**kwargs
    Additional parameters that are only valid to configure a coroutine or file sink (see
    below).


If and only if the sink is a coroutine function, the following parameter applies:

Parameters
----------
loop : |AbstractEventLoop|, optional
    The event loop in which the asynchronous logging task will be scheduled and executed. If
    ``None``, the loop used is the one returned by |asyncio.get_running_loop| at the time of
    the logging call (task is discarded if there is no loop currently running).


If and only if the sink is a file path, the following parameters apply:

Parameters
----------
rotation : |str|, |int|, |time|, |timedelta| or |callable|_, optional
    A condition indicating whenever the current logged file should be closed and a new one
    started.
retention : |str|, |int|, |timedelta| or |callable|_, optional
    A directive filtering old files that should be removed during rotation or end of
    program.
compression : |str| or |callable|_, optional
    A compression or archive format to which log files should be converted at closure.
delay : |bool|, optional
    Whether the file should be created as soon as the sink is configured, or delayed until
    first logged message. It defaults to ``False``.
watch : |bool|, optional
    Whether or not the file should be watched and re-opened when deleted or changed (based
    on its device and inode properties) by an external program. It defaults to ``False``.
mode : |str|, optional
    The opening mode as for built-in |open| function. It defaults to ``"a"`` (open the
    file in appending mode).
buffering : |int|, optional
    The buffering policy as for built-in |open| function. It defaults to ``1`` (line
    buffered file).
encoding : |str|, optional
    The file encoding as for built-in |open| function. It defaults to ``"utf8"``.
**kwargs
    Others parameters are passed to the built-in |open| function.

Returns
-------
:class:`int`
    An identifier associated with the added sink and which should be used to
    |remove| it.

Raises
------
ValueError
    If any of the arguments passed to configure the sink is invalid.

Notes
-----
Extended summary follows.

.. _sink:

.. rubric:: The sink parameter

The ``sink`` handles incoming log messages and proceed to their writing somewhere and
somehow. A sink can take many forms:

- A |file-like object|_ like ``sys.stderr`` or ``open("file.log", "w")``. Anything with
  a ``.write()`` method is considered as a file-like object. Custom handlers may also
  implement ``flush()`` (called after each logged message), ``stop()`` (called at sink
  termination) and ``complete()`` (awaited by the eponymous method).
- A file path as |str| or |Path|. It can be parametrized with some additional parameters,
  see below.
- A |callable|_ (such as a simple function) like ``lambda msg: print(msg)``. This
  allows for logging procedure entirely defined by user preferences and needs.
- A asynchronous |coroutine function|_ defined with the ``async def`` statement. The
  coroutine object returned by such function will be added to the event loop using
  |loop.create_task|. The tasks should be awaited before ending the loop by using
  |complete|.
- A built-in |Handler| like ``logging.StreamHandler``. In such a case, the `Loguru` records
  are automatically converted to the structure expected by the |logging| module.

Note that the logging functions are not `reentrant`_. This means you should avoid using
the ``logger`` inside any of your sinks or from within |signal| handlers. Otherwise, you
may face deadlock if the module's sink was not explicitly disabled.

.. _message:

.. rubric:: The logged message

The logged message passed to all added sinks is nothing more than a string of the
formatted log, to which a special attribute is associated: the ``.record`` which is a dict
containing all contextual information possibly needed (see below).

Logged messages are formatted according to the ``format`` of the added sink. This format
is usually a string containing braces fields to display attributes from the record dict.

If fine-grained control is needed, the ``format`` can also be a function which takes the
record as parameter and return the format template string. However, note that in such a
case, you should take care of appending the line ending and exception field to the returned
format, while ``"\n{exception}"`` is automatically appended for convenience if ``format`` is
a string.

The ``filter`` attribute can be used to control which messages are effectively passed to the
sink and which one are ignored. A function can be used, accepting the record as an
argument, and returning ``True`` if the message should be logged, ``False`` otherwise. If
a string is used, only the records with the same ``name`` and its children will be allowed.
One can also pass a ``dict`` mapping module names to minimum required level. In such case,
each log record will search for it's closest parent in the ``dict`` and use the associated
level as the filter. The ``dict`` values can be ``int`` severity, ``str`` level name or
``True`` and ``False`` to respectively authorize and discard all module logs
unconditionally. In order to set a default level, the ``""`` module name should be used as
it is the parent of all modules (it does not suppress global ``level`` threshold, though).

Note that while calling a logging method, the keyword arguments (if any) are automatically
added to the ``extra`` dict for convenient contextualization (in addition to being used for
formatting).

.. _levels:

.. rubric:: The severity levels

Each logged message is associated with a severity level. These levels make it possible to
prioritize messages and to choose the verbosity of the logs according to usages. For
example, it allows to display some debugging information to a developer, while hiding it to
the end user running the application.

The ``level`` attribute of every added sink controls the minimum threshold from which log
messages are allowed to be emitted. While using the ``logger``, you are in charge of
configuring the appropriate granularity of your logs. It is possible to add even more custom
levels by using the |level| method.

Here are the standard levels with their default severity value, each one is associated with
a logging method of the same name:

+----------------------+------------------------+------------------------+
| Level name           | Severity value         | Logger method          |
+======================+========================+========================+
| ``TRACE``            | 5                      | |logger.trace|         |
+----------------------+------------------------+------------------------+
| ``DEBUG``            | 10                     | |logger.debug|         |
+----------------------+------------------------+------------------------+
| ``INFO``             | 20                     | |logger.info|          |
+----------------------+------------------------+------------------------+
| ``SUCCESS``          | 25                     | |logger.success|       |
+----------------------+------------------------+------------------------+
| ``WARNING``          | 30                     | |logger.warning|       |
+----------------------+------------------------+------------------------+
| ``ERROR``            | 40                     | |logger.error|         |
+----------------------+------------------------+------------------------+
| ``CRITICAL``         | 50                     | |logger.critical|      |
+----------------------+------------------------+------------------------+

.. _record:

.. rubric:: The record dict

The record is just a Python dict, accessible from sinks by ``message.record``. It contains
all contextual information of the logging call (time, function, file, line, level, etc.).

Each of the record keys can be used in the handler's ``format`` so the corresponding value
is properly displayed in the logged message (e.g. ``"{level}"`` will return ``"INFO"``).
Some records' values are objects with two or more attributes. These can be formatted with
``"{key.attr}"`` (``"{key}"`` would display one by default).

Note that you can use any `formatting directives`_ available in Python's ``str.format()``
method (e.g. ``"{key: >3}"`` will right-align and pad to a width of 3 characters). This is
particularly useful for time formatting (see below).

+------------+---------------------------------+----------------------------+
| Key        | Description                     | Attributes                 |
+============+=================================+============================+
| elapsed    | The time elapsed since the      | See |timedelta|            |
|            | start of the program            |                            |
+------------+---------------------------------+----------------------------+
| exception  | The formatted exception if any, | ``type``, ``value``,       |
|            | ``None`` otherwise              | ``traceback``              |
+------------+---------------------------------+----------------------------+
| extra      | The dict of attributes          | None                       |
|            | bound by the user (see |bind|)  |                            |
+------------+---------------------------------+----------------------------+
| file       | The file where the logging call | ``name`` (default),        |
|            | was made                        | ``path``                   |
+------------+---------------------------------+----------------------------+
| function   | The function from which the     | None                       |
|            | logging call was made           |                            |
+------------+---------------------------------+----------------------------+
| level      | The severity used to log the    | ``name`` (default),        |
|            | message                         | ``no``, ``icon``           |
+------------+---------------------------------+----------------------------+
| line       | The line number in the source   | None                       |
|            | code                            |                            |
+------------+---------------------------------+----------------------------+
| message    | The logged message (not yet     | None                       |
|            | formatted)                      |                            |
+------------+---------------------------------+----------------------------+
| module     | The module where the logging    | None                       |
|            | call was made                   |                            |
+------------+---------------------------------+----------------------------+
| name       | The ``__name__`` where the      | None                       |
|            | logging call was made           |                            |
+------------+---------------------------------+----------------------------+
| process    | The process in which the        | ``name``, ``id`` (default) |
|            | logging call was made           |                            |
+------------+---------------------------------+----------------------------+
| thread     | The thread in which the         | ``name``, ``id`` (default) |
|            | logging call was made           |                            |
+------------+---------------------------------+----------------------------+
| time       | The aware local time when the   | See |datetime|             |
|            | logging call was made           |                            |
+------------+---------------------------------+----------------------------+

.. _time:

.. rubric:: The time formatting

To use your favorite time representation, you can set it directly in the time formatter
specifier of your handler format, like for example ``format="{time:HH:mm:ss} {message}"``.
Note that this datetime represents your local time, and it is also made timezone-aware,
so you can display the UTC offset to avoid ambiguities.

The time field can be formatted using more human-friendly tokens. These constitute a subset
of the one used by the `Pendulum`_ library of `@sdispater`_. To escape a token, just add
square brackets around it, for example ``"[YY]"`` would display literally ``"YY"``.

If you prefer to display UTC rather than local time, you can add ``"!UTC"`` at the very end
of the time format, like ``{time:HH:mm:ss!UTC}``. Doing so will convert the ``datetime``
to UTC before formatting.

If no time formatter specifier is used, like for example if ``format="{time} {message}"``,
the default one will use ISO 8601.

+------------------------+---------+----------------------------------------+
|                        | Token   | Output                                 |
+========================+=========+========================================+
| Year                   | YYYY    | 2000, 2001, 2002 ... 2012, 2013        |
|                        +---------+----------------------------------------+
|                        | YY      | 00, 01, 02 ... 12, 13                  |
+------------------------+---------+----------------------------------------+
| Quarter                | Q       | 1 2 3 4                                |
+------------------------+---------+----------------------------------------+
| Month                  | MMMM    | January, February, March ...           |
|                        +---------+----------------------------------------+
|                        | MMM     | Jan, Feb, Mar ...                      |
|                        +---------+----------------------------------------+
|                        | MM      | 01, 02, 03 ... 11, 12                  |
|                        +---------+----------------------------------------+
|                        | M       | 1, 2, 3 ... 11, 12                     |
+------------------------+---------+----------------------------------------+
| Day of Year            | DDDD    | 001, 002, 003 ... 364, 365             |
|                        +---------+----------------------------------------+
|                        | DDD     | 1, 2, 3 ... 364, 365                   |
+------------------------+---------+----------------------------------------+
| Day of Month           | DD      | 01, 02, 03 ... 30, 31                  |
|                        +---------+----------------------------------------+
|                        | D       | 1, 2, 3 ... 30, 31                     |
+------------------------+---------+----------------------------------------+
| Day of Week            | dddd    | Monday, Tuesday, Wednesday ...         |
|                        +---------+----------------------------------------+
|                        | ddd     | Mon, Tue, Wed ...                      |
|                        +---------+----------------------------------------+
|                        | d       | 0, 1, 2 ... 6                          |
+------------------------+---------+----------------------------------------+
| Days of ISO Week       | E       | 1, 2, 3 ... 7                          |
+------------------------+---------+----------------------------------------+
| Hour                   | HH      | 00, 01, 02 ... 23, 24                  |
|                        +---------+----------------------------------------+
|                        | H       | 0, 1, 2 ... 23, 24                     |
|                        +---------+----------------------------------------+
|                        | hh      | 01, 02, 03 ... 11, 12                  |
|                        +---------+----------------------------------------+
|                        | h       | 1, 2, 3 ... 11, 12                     |
+------------------------+---------+----------------------------------------+
| Minute                 | mm      | 00, 01, 02 ... 58, 59                  |
|                        +---------+----------------------------------------+
|                        | m       | 0, 1, 2 ... 58, 59                     |
+------------------------+---------+----------------------------------------+
| Second                 | ss      | 00, 01, 02 ... 58, 59                  |
|                        +---------+----------------------------------------+
|                        | s       | 0, 1, 2 ... 58, 59                     |
+------------------------+---------+----------------------------------------+
| Fractional Second      | S       | 0 1 ... 8 9                            |
|                        +---------+----------------------------------------+
|                        | SS      | 00, 01, 02 ... 98, 99                  |
|                        +---------+----------------------------------------+
|                        | SSS     | 000 001 ... 998 999                    |
|                        +---------+----------------------------------------+
|                        | SSSS... | 000[0..] 001[0..] ... 998[0..] 999[0..]|
|                        +---------+----------------------------------------+
|                        | SSSSSS  | 000000 000001 ... 999998 999999        |
+------------------------+---------+----------------------------------------+
| AM / PM                | A       | AM, PM                                 |
+------------------------+---------+----------------------------------------+
| Timezone               | Z       | -07:00, -06:00 ... +06:00, +07:00      |
|                        +---------+----------------------------------------+
|                        | ZZ      | -0700, -0600 ... +0600, +0700          |
|                        +---------+----------------------------------------+
|                        | zz      | EST CST ... MST PST                    |
+------------------------+---------+----------------------------------------+
| Seconds timestamp      | X       | 1381685817, 1234567890.123             |
+------------------------+---------+----------------------------------------+
| Microseconds timestamp | x       | 1234567890123                          |
+------------------------+---------+----------------------------------------+

.. _file:

.. rubric:: The file sinks

If the sink is a |str| or a |Path|, the corresponding file will be opened for writing logs.
The path can also contain a special ``"{time}"`` field that will be formatted with the
current date at file creation. The file is closed at sink stop, i.e. when the application
ends or the handler is removed.

The ``rotation`` check is made before logging each message. If there is already an existing
file with the same name that the file to be created, then the existing file is renamed by
appending the date to its basename to prevent file overwriting. This parameter accepts:

- an |int| which corresponds to the maximum file size in bytes before that the current
  logged file is closed and a new one started over.
- a |timedelta| which indicates the frequency of each new rotation.
- a |time| which specifies the hour when the daily rotation should occur.
- a |str| for human-friendly parametrization of one of the previously enumerated types.
  Examples: ``"100 MB"``, ``"0.5 GB"``, ``"1 month 2 weeks"``, ``"4 days"``, ``"10h"``,
  ``"monthly"``, ``"18:00"``, ``"sunday"``, ``"w0"``, ``"monday at 12:00"``, ...
- a |callable|_ which will be invoked before logging. It should accept two arguments: the
  logged message and the file object, and it should return ``True`` if the rotation should
  happen now, ``False`` otherwise.

The ``retention`` occurs at rotation or at sink stop if rotation is ``None``. Files
resulting from previous sessions or rotations are automatically collected from disk. A file
is selected if it matches the pattern ``"basename(.*).ext(.*)"`` (possible time fields are
beforehand replaced with ``.*``) based on the configured sink. Afterwards, the list is
processed to determine files to be retained. This parameter accepts:

- an |int| which indicates the number of log files to keep, while older files are deleted.
- a |timedelta| which specifies the maximum age of files to keep.
- a |str| for human-friendly parametrization of the maximum age of files to keep.
  Examples: ``"1 week, 3 days"``, ``"2 months"``, ...
- a |callable|_ which will be invoked before the retention process. It should accept the
  list of log files as argument and process to whatever it wants (moving files, removing
  them, etc.).

The ``compression`` happens at rotation or at sink stop if rotation is ``None``. This
parameter accepts:

- a |str| which corresponds to the compressed or archived file extension. This can be one
  of: ``"gz"``, ``"bz2"``, ``"xz"``, ``"lzma"``, ``"tar"``, ``"tar.gz"``, ``"tar.bz2"``,
  ``"tar.xz"``, ``"zip"``.
- a |callable|_ which will be invoked before file termination. It should accept the path of
  the log file as argument and process to whatever it wants (custom compression, network
  sending, removing it, etc.).

Either way, if you use a custom function designed according to your preferences, you must be
very careful not to use the ``logger`` within your function. Otherwise, there is a risk that
your program hang because of a deadlock.

.. _color:

.. rubric:: The color markups

To add colors to your logs, you just have to enclose your format string with the appropriate
tags (e.g. ``<red>some message</red>``). These tags are automatically removed if the sink
doesn't support ansi codes. For convenience, you can use ``</>`` to close the last opening
tag without repeating its name (e.g. ``<red>another message</>``).

The special tag ``<level>`` (abbreviated with ``<lvl>``) is transformed according to
the configured color of the logged message level.

Tags which are not recognized will raise an exception during parsing, to inform you about
possible misuse. If you wish to display a markup tag literally, you can escape it by
prepending a ``\`` like for example ``\<blue>``. To prevent the escaping to occur, you can
simply double the ``\`` (e.g. ``\\<blue>`` will print a literal ``\`` before colored text).
If, for some reason, you need to escape a string programmatically, note that the regex used
internally to parse markup tags is ``r"(\\*)(</?(?:[fb]g\s)?[^<>\s]*>)"``.

Note that when logging a message with ``opt(colors=True)``, color tags present in the
formatting arguments (``args`` and ``kwargs``) are completely ignored. This is important if
you need to log strings containing markups that might interfere with the color tags (in this
case, do not use f-string).

Here are the available tags (note that compatibility may vary depending on terminal):

+------------------------------------+--------------------------------------+
| Color (abbr)                       | Styles (abbr)                        |
+====================================+======================================+
| Black (k)                          | Bold (b)                             |
+------------------------------------+--------------------------------------+
| Blue (e)                           | Dim (d)                              |
+------------------------------------+--------------------------------------+
| Cyan (c)                           | Normal (n)                           |
+------------------------------------+--------------------------------------+
| Green (g)                          | Italic (i)                           |
+------------------------------------+--------------------------------------+
| Magenta (m)                        | Underline (u)                        |
+------------------------------------+--------------------------------------+
| Red (r)                            | Strike (s)                           |
+------------------------------------+--------------------------------------+
| White (w)                          | Reverse (v)                          |
+------------------------------------+--------------------------------------+
| Yellow (y)                         | Blink (l)                            |
+------------------------------------+--------------------------------------+
|                                    | Hide (h)                             |
+------------------------------------+--------------------------------------+

Usage:

+-----------------+-------------------------------------------------------------------+
| Description     | Examples                                                          |
|                 +---------------------------------+---------------------------------+
|                 | Foreground                      | Background                      |
+=================+=================================+=================================+
| Basic colors    | ``<red>``, ``<r>``              | ``<GREEN>``, ``<G>``            |
+-----------------+---------------------------------+---------------------------------+
| Light colors    | ``<light-blue>``, ``<le>``      | ``<LIGHT-CYAN>``, ``<LC>``      |
+-----------------+---------------------------------+---------------------------------+
| 8-bit colors    | ``<fg 86>``, ``<fg 255>``       | ``<bg 42>``, ``<bg 9>``         |
+-----------------+---------------------------------+---------------------------------+
| Hex colors      | ``<fg #00005f>``, ``<fg #EE1>`` | ``<bg #AF5FD7>``, ``<bg #fff>`` |
+-----------------+---------------------------------+---------------------------------+
| RGB colors      | ``<fg 0,95,0>``                 | ``<bg 72,119,65>``              |
+-----------------+---------------------------------+---------------------------------+
| Stylizing       | ``<bold>``, ``<b>``,  ``<underline>``, ``<u>``                    |
+-----------------+-------------------------------------------------------------------+

.. _env:

.. rubric:: The environment variables

The default values of sink parameters can be entirely customized. This is particularly
useful if you don't like the log format of the pre-configured sink.

Each of the |add| default parameter can be modified by setting the ``LOGURU_[PARAM]``
environment variable. For example on Linux: ``export LOGURU_FORMAT="{time} - {message}"``
or ``export LOGURU_DIAGNOSE=NO``.

The default levels' attributes can also be modified by setting the ``LOGURU_[LEVEL]_[ATTR]``
environment variable. For example, on Windows: ``setx LOGURU_DEBUG_COLOR "<blue>"``
or ``setx LOGURU_TRACE_ICON "🚀"``. If you use the ``set`` command, do not include quotes
but escape special symbol as needed, e.g. ``set LOGURU_DEBUG_COLOR=^<blue^>``.

If you want to disable the pre-configured sink, you can set the ``LOGURU_AUTOINIT``
variable to ``False``.

On Linux, you will probably need to edit the ``~/.profile`` file to make this persistent. On
Windows, don't forget to restart your terminal for the change to be taken into account.

Examples
--------
>>> logger.add(sys.stdout, format="{time} - {level} - {message}", filter="sub.module")

>>> logger.add("file_{time}.log", level="TRACE", rotation="100 MB")

>>> def debug_only(record):
...     return record["level"].name == "DEBUG"
...
>>> logger.add("debug.log", filter=debug_only)  # Other levels are filtered out

>>> def my_sink(message):
...     record = message.record
...     update_db(message, time=record["time"], level=record["level"])
...
>>> logger.add(my_sink)

>>> level_per_module = {
...     "": "DEBUG",
...     "third.lib": "WARNING",
...     "anotherlib": False
... }
>>> logger.add(lambda m: print(m, end=""), filter=level_per_module, level=0)

>>> async def publish(message):
...     await api.post(message)
...
>>> logger.add(publish, serialize=True)

>>> from logging import StreamHandler
>>> logger.add(StreamHandler(sys.stderr), format="{message}")

>>> class RandomStream:
...     def __init__(self, seed, threshold):
...         self.threshold = threshold
...         random.seed(seed)
...     def write(self, message):
...         if random.random() > self.threshold:
...             print(message)
...
>>> stream_object = RandomStream(seed=12345, threshold=0.25)
>>> logger.add(stream_object, level="INFO")
r   NFz'%s'
r;   writer)   Tencoding__call__rv   loopzAn event loop is required to add a coroutine sink with `enqueue=True`, but none has been passed as argument and none is currently running.utf8z"Cannot log to objects of type '%s'z-add() got an unexpected keyword argument '%s'.)parentlengthzVThe filter dict contains an invalid module, it should be a string (or None), not: '%s'r   z#The filter dict contains a module 'z4' associated to a level name which does not exist: ''zX' associated to an invalid level, it should be an integer, a string or a boolean, not: 'zqThe filter dict contains a module '%s' associated to an invalid level, it should be a positive integer, not: '%d')level_per_modulezThe built-in 'filter()' function cannot be used as a 'filter' parameter, this is most likely a mistake (please double-check the arguments passed to 'logger.add()').zFInvalid filter, it should be a function, a string or a dict, not: '%s'=Invalid level, it should be an integer or a string, not: '%s'=Invalid level value, it should be a positive integer, not: %dz{exception}z;Invalid format, color markups could not be parsed correctlyzThe built-in 'format()' function cannot be used as a 'format' parameter, this is most likely a mistake (please double-check the arguments passed to 'logger.add()').z>Invalid format, it should be a string or a function, not: '%s'asciizNInvalid context, it should be a string or a multiprocessing context, not: '%s')r   r   r   r   hidden_frames_filenameprefix)r)   sinklevelno	formatteris_formatter_dynamicfilter_r   r   r   multiprocessing_contextid_error_interceptorexception_formatterrU   )@r   rc   rW   r   
isinstancestrr&   r   r   hasattrcallabler   getattrreprr   should_colorizeshould_wrapwrapr#   loggingr   r"   r   popr   get_running_loopRuntimeError
ValueErrorr   r    r!   	TypeErrortyperv   nextiterr   filter_nonelen	functoolspartialfilter_by_namedictrS   re   r*   intfilter_by_levelbuiltinsr   r   prepare_formatr   r   r	   r   r   __code__co_filenamerU   rX   rk   minr\   )&rd   r   re   r   r   r   r   r   r   r   r   r   kwargs
handler_idr   pathr)   wrapped_sinkr   
terminatorexception_prefixstreamr   ecorofilter_funcr   r   r   modulelevel_levelno_r   r   r   r   handlerrX   s&                                         rf   add
Logger.add   sY   ~ ZZ__22JJJ%%*%  -UJ?	HdS(O,,DD=D #D3F3LF#,,HJ!T7##(<(<4.<$t*D$44T:4I$9$9$$?$?"-%f-LtZ6HJ!goo..:D '-LtZ6HJ# &&*=D*d++
 +
 4T2@d4jD ::fd+D 4<(99;D /t444$--D$T41BCLHJ!d^^4T2@d4jD '-LHJ!@4:CVCVVWWKdSWX^S_N``aa>Kr\"..K$$c\F[F#++H,C,CF[abK%%!"(,,.%j.E.E#EGKF|G\G\]  U?$Ht^ H,,$#'::f#5#8#8  ,,%H# "4<#8#8: 
 a<$EHNPXGYZ  ,4 (? #1@ $++((;KK f( * 
 !KXv,''( 
 eS!!jj'**Gs##GOu+&&' 
 Q;ORYY  fc""%44Vj5H=5XY	
 $) f( * 
 I#' Pv,''( 
 (C((Hgs##!'*G G[)I)I"7m445 
 ZZ__"4!!!#'+zz':':'F'F'# !#%9#!#(/"3$7"&**">">G" zz**//1H#*HZ #&tzz';';W#EDJJ "*DJJ? B Q _@ $ $^ d & $(<BFL  $$$l   Q> _B sT   6\='] 3]-8^ 3C ^.=
]
]*]%%]*- ^
^+^&&^+.
^=Nc                    Ub6  [        U[        5      (       d!  [        S[        U5      R                  -  5      eU R
                  R                     Ub(  XR
                  R                  ;  a  [        SU-  5      SeUc   [        U R
                  R                  5      nOU/nU H  nU R
                  R                  R                  5       nUR                  U5      nS UR                  5        5       n[        U[        S5      S9U R
                  l        X0R
                  l        UR!                  5         M     SSS5        g! , (       d  f       g= f)aB  Remove a previously added handler and stop sending logs to its sink.

Parameters
----------
handler_id : |int| or ``None``
    The id of the sink to remove, as it was returned by the |add| method. If ``None``, all
    handlers are removed. The pre-configured handler is guaranteed to have the index ``0``.

Raises
------
ValueError
    If ``handler_id`` is not ``None`` but there is no active handler with such id.

Examples
--------
>>> i = logger.add(sys.stderr, format="{message}")
>>> logger.info("Logging")
Logging
>>> logger.remove(i)
>>> logger.info("No longer logging")
NzbInvalid handler id, it should be an integer as returned by the 'add()' method (or None), not: '%s'z'There is no existing handler with id %dc              3   8   #    U  H  oR                   v   M     g 7frr   )r   ).0hs     rf   	<genexpr> Logger.remove.<locals>.<genexpr>&  s     A/@!II/@s   r<   r.   )r   r   r   r   rv   r   rc   rX   r   r   rk   r   r   r   r[   r\   stop)rd   r   handler_idsrX   r   levelnoss         rf   removeLogger.remove  s   , "jS&A&A=?CJ?O?X?XY 
 ZZ__%*JJ<O<O*O !JZ!WX^bb!"4::#6#67)l)
::..335",,z2 Bx/@A'*8U5\'J

$&.

# * __s   C)E
Ec                 d  ^ / mU R                   R                     U R                   R                  R                  5       nUR	                  5        H2  nUR                  5         TR                  UR                  5       5        M4     SSS5         " U4S jS5      nU" 5       $ ! , (       d  f       N"= f)aV  Wait for the end of enqueued messages and asynchronous tasks scheduled by handlers.

This method proceeds in two steps: first it waits for all logging messages added to handlers
with ``enqueue=True`` to be processed, then it returns an object that can be awaited to
finalize all logging tasks added to the event loop by coroutine sinks.

It can be called from non-asynchronous code. This is especially recommended when the
``logger`` is utilized with ``multiprocessing`` to ensure messages put to the internal
queue have been properly transmitted before leaving a child process.

The returned object should be awaited before the end of a coroutine executed by
|asyncio.run| or |loop.run_until_complete| to ensure all asynchronous logging messages are
processed. The function |asyncio.get_running_loop| is called beforehand, only tasks
scheduled in the same loop that the current one will be awaited by the method.

Returns
-------
:term:`awaitable`
    An awaitable object which ensures all asynchronous logging calls are completed when
    awaited.

Examples
--------
>>> async def sink(message):
...     await asyncio.sleep(0.1)  # IO processing...
...     print(message, end="")
...
>>> async def work():
...     logger.info("Start")
...     logger.info("End")
...     await logger.complete()
...
>>> logger.add(sink)
1
>>> asyncio.run(work())
Start
End

>>> def process():
...     logger.info("Message sent from the child")
...     logger.complete()
...
>>> logger.add(sys.stderr, enqueue=True)
1
>>> process = multiprocessing.Process(target=process)
>>> process.start()
>>> process.join()
Message sent from the child
Nc                   "   > \ rS rSrU 4S jrSrg)+Logger.complete.<locals>.AwaitableCompleterif  c              3   T   >#    T H  nUR                  5        S h  vN   M     g  N	7frr   )	__await__)rd   tasktaskss     rf   r   5Logger.complete.<locals>.AwaitableCompleter.__await__g  s#     !D#~~/// "/s   (&
(r{   N)rv   rw   rx   ry   r   rz   )r   s   rf   AwaitableCompleterr   f  s    0 0rp   r   )r   rc   rX   rk   r   complete_queueextendtasks_to_complete)rd   rX   r   r   r   s       @rf   completeLogger.complete,  s    d ZZ__zz**//1H#??,&&(W6689 - 	0 	0
 "## _s   A+B!!
B/r9   FzAn error has been caught in function '{record[function]}', process '{record[process].name}' ({record[process].id}), thread '{record[thread].name}' ({record[thread].id}):)re   reraiseonerrorexcluder/   messagec                   ^^^^^^^^^	 [        T5      (       a;  [        T5      (       a  [        T[        5      (       d  U R	                  5       " T5      $ U m	 " UUUUUU	UUU4	S jS5      mT" S5      $ )uT
  Return a decorator to automatically log possibly caught error in wrapped function.

This is useful to ensure unexpected exceptions are logged, the entire program can be
wrapped by this method. This is also very useful to decorate |Thread.run| methods while
using threads to propagate errors to the main logger thread.

Note that the visibility of variables values (which uses the great |better_exceptions|_
library from `@Qix-`_) depends on the ``diagnose`` option of each configured sink.

The returned object can also be used as a context manager.

Parameters
----------
exception : |Exception|, optional
    The type of exception to intercept. If several types should be caught, a tuple of
    exceptions can be used too.
level : |str| or |int|, optional
    The level name or severity with which the message should be logged.
reraise : |bool|, optional
    Whether the exception should be raised again and hence propagated to the caller.
onerror : |callable|_, optional
    A function that will be called if an error occurs, once the message has been logged.
    It should accept the exception instance as it sole argument.
exclude : |Exception|, optional
    A type of exception (or a tuple of types) that will be purposely ignored and hence
    propagated to the caller without being logged.
default : |Any|, optional
    The value to be returned by the decorated function if an error occurred without being
    re-raised.
message : |str|, optional
    The message that will be automatically logged if an exception occurs. Note that it will
    be formatted with the ``record`` attribute.

Returns
-------
:term:`decorator` / :term:`context manager`
    An object that can be used to decorate a function or as a context manager to log
    exceptions possibly caught.

Examples
--------
>>> @logger.catch
... def f(x):
...     100 / x
...
>>> def g():
...     f(10)
...     f(0)
...
>>> g()
ERROR - An error has been caught in function 'g', process 'Main' (367), thread 'ch1' (1398):
Traceback (most recent call last):
  File "program.py", line 12, in <module>
    g()
    └ <function g at 0x7f225fe2bc80>
> File "program.py", line 10, in g
    f(0)
    └ <function f at 0x7f225fe2b9d8>
  File "program.py", line 6, in f
    100 / x
          └ 0
ZeroDivisionError: division by zero

>>> with logger.catch(message="Because we never know..."):
...    main()  # No exception, no logs

>>> # Use 'onerror' to prevent the program exit code to be 0 (if 'reraise=False') while
>>> # also avoiding the stacktrace to be duplicated on stderr (if 'reraise=True').
>>> @logger.catch(onerror=lambda _: sys.exit(1))
... def main():
...     1 / 0
c                   H   >	 \ rS rSrS rS rUUUUUUU4S jrU U4S jrSrg)Logger.catch.<locals>.Catcheri  c                     Xl         g rr   _from_decorator)rd   from_decorators     rf   rg   &Logger.catch.<locals>.Catcher.__init__  s    '5$rp   c                     g rr   r{   r   s    rf   	__enter__'Logger.catch.<locals>.Catcher.__enter__  s    rp   c                   > Uc  g [        TR                  R                  SS5      (       a  g[        UT	5      (       d  gT
b  [        UT
5      (       a  gU R                  nTR
                  tpVpWU(       a  US-  nXU4US/UQnSTR                  R                  l         TR                  TXHTS0 5        STR                  R                  l        Tb  T" U5        T(       + $ ! STR                  R                  l        f = f)Nalready_logging_exceptionFr   Tr{   )r   r   rb   
issubclassr  r   r  _log)rd   type_value
traceback_r  _r   optionscatch_optionsr   r   re   loggerr  r   r   s            rf   __exit__&Logger.catch.<locals>.Catcher.__exit__  s    = 6<<557RTYZZ !%33 &:eW+E+E !%!5!5(.%!!QJE"'
!;UD S7 SGK**DQKK~grSUVKPFLL..H&EN"{" LQFLL..Hs   C! !C>c                   >^^ [        T5      (       a  [        STR                  -  5      eT" S5      m[        T5      (       a	  UUU4S jnO![	        T5      (       a	  UUU4S jnOUUU4S jn[
        R                  " UT5        U$ )Nz`Invalid object decorated with 'catch()', it must be a function, not a class (tried to wrap '%s')Tc                  l   >#    T   T" U 0 UD6I S h  vN sS S S 5        $  N! , (       d  f       T$ = f7frr   r{   argsr   catcherr/   functions     rf   catch_wrapper=Logger.catch.<locals>.Catcher.__call__.<locals>.catch_wrapper  s/     $)14)B6)B#B %W#B %W&    4" "
4"
14c               ?   l   >#    T   T" U 0 UD6 S h  vN sS S S 5        $  N! , (       d  f       T$ = f7frr   r{   r  s     rf   r   r!    s/     $/7/H/H$H %W$H %W&r"  c                  P   > T   T" U 0 UD6sS S S 5        $ ! , (       d  f       T$ = frr   r{   r  s     rf   r   r!    s"    $#+T#<V#< %WW&s   
%)r   r   rv   r   r   r   update_wrapper)rd   r  r   r  Catcherr/   s    ` @rf   r   &Logger.catch.<locals>.Catcher.__call__  s    8$$#;=E=N=NO 
 "$-&x00' '
 )22' ''
 ((A$$rp   r  N)	rv   rw   rx   ry   rg   r  r  r   rz   )	r&  r/   r   r   re   r  r  r   r   s	   rf   r&  r    s"    6$# $#L% %rp   r&  F)r   r   r  BaseExceptionr   )
rd   r   re   r   r   r   r/   r  r&  r  s
    ```````@@rf   r   Logger.catchm  s^    j I	""*Y*N*N::<	**L	% L	% L	%\ u~rp   Tr   )r   r   r   r   r   r   r   ansic          
          U(       a  Sn[         R                  " S[        SS9  U R                  SS n	[	        U R
                  XX#XEU/U	Q76 $ )a  Parametrize a logging call to slightly change generated log message.

Note that it's not possible to chain |opt| calls, the last one takes precedence over the
others as it will "reset" the options to their default values.

Parameters
----------
exception : |bool|, |tuple| or |Exception|, optional
    If it does not evaluate as ``False``, the passed exception is formatted and added to the
    log message. It could be an |Exception| object or a ``(type, value, traceback)`` tuple,
    otherwise the exception information is retrieved from |sys.exc_info|.
record : |bool|, optional
    If ``True``, the record dict contextualizing the logging call can be used to format the
    message by using ``{record[key]}`` in the log message.
lazy : |bool|, optional
    If ``True``, the logging call attribute to format the message should be functions which
    will be called only if the level is high enough. This can be used to avoid expensive
    functions if not necessary.
colors : |bool|, optional
    If ``True``, logged message will be colorized according to the markups it possibly
    contains.
raw : |bool|, optional
    If ``True``, the formatting of each sink will be bypassed and the message will be sent
    as is.
capture : |bool|, optional
    If ``False``, the ``**kwargs`` of logged message will not automatically populate
    the ``extra`` dict (although they are still used for formatting).
depth : |int|, optional
    Specify which stacktrace should be used to contextualize the logged message. This is
    useful while using the logger from inside a wrapped function to retrieve worthwhile
    information.
ansi : |bool|, optional
    Deprecated since version 0.4.1: the ``ansi`` parameter will be removed in Loguru 1.0.0,
    it is replaced by ``colors`` which is a more appropriate name.

Returns
-------
:class:`~Logger`
    A logger wrapping the core logger, but transforming logged message adequately before
    sending.

Examples
--------
>>> try:
...     1 / 0
... except ZeroDivisionError:
...    logger.opt(exception=True).debug("Exception logged with debug level:")
...
[18:10:02] DEBUG in '<module>' - Exception logged with debug level:
Traceback (most recent call last, catch point marked):
> File "<stdin>", line 2, in <module>
ZeroDivisionError: division by zero

>>> logger.opt(record=True).info("Current line is: {record[line]}")
[18:10:33] INFO in '<module>' - Current line is: 1

>>> logger.opt(lazy=True).debug("If sink <= DEBUG: {x}", x=lambda: math.factorial(2**5))
[18:11:19] DEBUG in '<module>' - If sink <= DEBUG: 263130836933693530167218012160000000

>>> logger.opt(colors=True).warning("We got a <red>BIG</red> problem")
[18:11:30] WARNING in '<module>' - We got a BIG problem

>>> logger.opt(raw=True).debug("No formatting\n")
No formatting

>>> logger.opt(capture=False).info("Displayed but not captured: {value}", value=123)
[18:11:41] Displayed but not captured: 123

>>> def wrapped():
...     logger.opt(depth=1).info("Get parent context")
...
>>> def func():
...     wrapped()
...
>>> func()
[18:11:54] DEBUG in 'func' - Get parent context
Tz?The 'ansi' parameter is deprecated, please use 'colors' instead   
stacklevelN)warningswarnDeprecationWarningr   r}   r   )
rd   r   r   r   r   r   r   r   r*  r  s
             rf   opt
Logger.opt  sQ    r FMMQ" }}RS!djj)F&w^Y]^^rp   c                 V    U R                   Gt p#[        U R                  /UQ0 UEUEP76 $ )a^  Bind attributes to the ``extra`` dict of each logged message record.

This is used to add custom context to each logging call.

Parameters
----------
**kwargs
    Mapping between keys and values that will be added to the ``extra`` dict.

Returns
-------
:class:`~Logger`
    A logger wrapping the core logger, but which sends record with the customized ``extra``
    dict.

Examples
--------
>>> logger.add(sys.stderr, format="{extra[ip]} - {message}")
>>> class Server:
...     def __init__(self, ip):
...         self.ip = ip
...         self.logger = logger.bind(ip=ip)
...     def call(self, message):
...         self.logger.info(message)
...
>>> instance_1 = Server("192.168.0.200")
>>> instance_2 = Server("127.0.0.1")
>>> instance_1.call("First instance")
192.168.0.200 - First instance
>>> instance_2.call("Second instance")
127.0.0.1 - Second instance
r   r}   r   )_Logger__selfr   r  rY   s       rf   bindLogger.bind}  s4    B !//fllBWB.A.A&.ABBrp   c              +     #    U R                   R                     0 [        R                  5       EUEn[        R	                  U5      nSSS5         Sv   U R                   R                     [        R                  W5        SSS5        g! , (       d  f       NH= f! , (       d  f       g= f! U R                   R                     [        R                  W5        SSS5        f ! , (       d  f       f = f= f7f)a  Bind attributes to the context-local ``extra`` dict while inside the ``with`` block.

Contrary to |bind| there is no ``logger`` returned, the ``extra`` dict is modified in-place
and updated globally. Most importantly, it uses |contextvars| which means that
contextualized values are unique to each threads and asynchronous tasks.

The ``extra`` dict will retrieve its initial state once the context manager is exited.

Parameters
----------
**kwargs
    Mapping between keys and values that will be added to the context-local ``extra`` dict.

Returns
-------
:term:`context manager` / :term:`decorator`
    A context manager (usable as a decorator too) that will bind the attributes once entered
    and restore the initial state of the ``extra`` dict while exited.

Examples
--------
>>> logger.add(sys.stderr, format="{message} | {extra}")
1
>>> def task():
...     logger.info("Processing!")
...
>>> with logger.contextualize(task_id=123):
...     task()
...
Processing! | {'task_id': 123}
>>> logger.info("Done.")
Done. | {}
N)r   rc   r   getsetreset)r7  r   new_contexttokens       rf   contextualizeLogger.contextualize  s     F \\5W[[]5f5KKK,E 	%""e$ #"  #"""e$ #""sd   C5.B	C5B+ C5*B 	C5	
BC5
B($C5+C2C!	C2!
C/+C22C5c                 \    U R                   Gt p#n[        U R                  /UQ/ UQUPPUP76 $ )at  Attach a function to modify the record dict created by each logging call.

The ``patcher`` may be used to update the record on-the-fly before it's propagated to the
handlers. This allows the "extra" dict to be populated with dynamic values and also permits
advanced modifications of the record emitted while logging a message. The function is called
once before sending the log message to the different handlers.

It is recommended to apply modification on the ``record["extra"]`` dict rather than on the
``record`` dict itself, as some values are used internally by `Loguru`, and modify them may
produce unexpected results.

The logger can be patched multiple times. In this case, the functions are called in the
same order as they are added.

Parameters
----------
patcher: |callable|_
    The function to which the record dict will be passed as the sole argument. This function
    is in charge of updating the record in-place, the function does not need to return any
    value, the modified record object will be re-used.

Returns
-------
:class:`~Logger`
    A logger wrapping the core logger, but which records are passed through the ``patcher``
    function before being sent to the added handlers.

Examples
--------
>>> logger.add(sys.stderr, format="{extra[utc]} {message}")
>>> logger = logger.patch(lambda record: record["extra"].update(utc=datetime.utcnow())
>>> logger.info("That's way, you can log messages with time displayed in UTC")

>>> def wrapper(func):
...     @functools.wraps(func)
...     def wrapped(*args, **kwargs):
...         logger.patch(lambda r: r.update(function=func.__name__)).info("Wrapped!")
...         return func(*args, **kwargs)
...     return wrapped

>>> def recv_record_from_network(pipe):
...     record = pickle.loads(pipe.read())
...     level, message = record["level"], record["message"]
...     logger.patch(lambda r: r.update(record)).log(level, message)
r6  )rd   rZ   r  r   rY   s        rf   patchLogger.patch  s<    \ %)MM!EdjjH7H,@h,@,@H%HHrp   c                    [        U[        5      (       d!  [        S[        U5      R                  -  5      eX#s=L a	  Us=L a  c  O  O U R
                  R                  U   $ XR
                  R                  ;  a  Uc  [        SU-  5      eSu  pVO%Ub  [        SU-  5      eU R                  U5      u  prpVUc  UnUc  Un[        U[        5      (       d!  [        S[        U5      R                  -  5      eUS:  a  [        S	U-  5      e[        R                  " U5      n[        XX45      n	U R
                  R                     XR
                  R                  U'   XR
                  R                  U'   XX$4U R
                  R                   U'   U R
                  R"                  R%                  5        H  n
U
R'                  U5        M     SSS5        U	$ ! [         a    [        SU-  5      Sef = f! , (       d  f       U	$ = f)
u  Add, update or retrieve a logging level.

Logging levels are defined by their ``name`` to which a severity ``no``, an ansi ``color``
tag and an ``icon`` are associated and possibly modified at run-time. To |log| to a custom
level, you should necessarily use its name, the severity number is not linked back to levels
name (this implies that several levels can share the same severity).

To add a new level, its ``name`` and its ``no`` are required. A ``color`` and an ``icon``
can also be specified or will be empty by default.

To update an existing level, pass its ``name`` with the parameters to be changed. It is not
possible to modify the ``no`` of a level once it has been added.

To retrieve level information, the ``name`` solely suffices.

Parameters
----------
name : |str|
    The name of the logging level.
no : |int|
    The severity of the level to be added or updated.
color : |str|
    The color markup of the level to be added or updated.
icon : |str|
    The icon of the level to be added or updated.

Returns
-------
``Level``
    A |namedtuple| containing information about the level.

Raises
------
ValueError
    If attempting to access a level with a ``name`` that is not registered, or if trying to
    change the severity ``no`` of an existing level.

Examples
--------
>>> level = logger.level("ERROR")
>>> print(level)
Level(name='ERROR', no=40, color='<red><bold>', icon='❌')
>>> logger.add(sys.stderr, format="{level.no} {level.icon} {message}")
1
>>> logger.level("CUSTOM", no=15, color="<blue>", icon="@")
Level(name='CUSTOM', no=15, color='<blue>', icon='@')
>>> logger.log("CUSTOM", "Logging...")
15 @ Logging...
>>> logger.level("WARNING", icon=r"/!\\")
Level(name='WARNING', no=30, color='<yellow><bold>', icon='/!\\\\')
>>> logger.warning("Updated!")
30 /!\\ Updated!
z4Invalid level name, it should be a string, not: '%s'NLevel '%s' does not existzILevel '%s' does not exist, you have to create it by specifying a level no)r;    z;Level '%s' already exists, you can't update its severity noz4Invalid level no, it should be an integer, not: '%s'r   z:Invalid level no, it should be a positive integer, not: %d)r   r   r   r   rv   r   rR   KeyErrorr   re   r   r   rT   r(   rc   rU   rV   rX   r   update_format)rd   r)   r*   r+   r,   	old_colorold_iconr  r*  re   r   s              rf   re   Logger.level  s   l $$$FdI\I\\  &$&&Ozz((.. zz(((z _  #*Ix^Z]aabb)-D)9&A9=E<D"c""FbIZIZZ  6Y\^^__&d,ZZ__&+JJd#15JJ((..2"-CDJJ$$T*::..557%%d+ 8	  O  O !<t!CD$NO@ _ s   	G BG1G.1
H c                 (    U R                  US5        g)a  Disable logging of messages coming from ``name`` module and its children.

Developers of library using `Loguru` should absolutely disable it to avoid disrupting
users with unrelated logs messages.

Note that in some rare circumstances, it is not possible for `Loguru` to
determine the module's ``__name__`` value. In such situation, ``record["name"]`` will be
equal to ``None``, this is why ``None`` is also a valid argument.

Parameters
----------
name : |str| or ``None``
    The name of the parent module to disable.

Examples
--------
>>> logger.info("Allowed message by default")
[22:21:55] Allowed message by default
>>> logger.disable("my_library")
>>> logger.info("While publishing a library, don't forget to disable logging")
FN_change_activationrd   r)   s     rf   disableLogger.disablef  s    , 	e,rp   c                 (    U R                  US5        g)az  Enable logging of messages coming from ``name`` module and its children.

Logging is generally disabled by imported library using `Loguru`, hence this function
allows users to receive these messages anyway.

To enable all logs regardless of the module they are coming from, an empty string ``""`` can
be passed.

Parameters
----------
name : |str| or ``None``
    The name of the parent module to re-allow.

Examples
--------
>>> logger.disable("__main__")
>>> logger.info("Disabled, so nothing is logged.")
>>> logger.enable("__main__")
>>> logger.info("Re-enabled, messages are logged.")
[22:46:12] Re-enabled, messages are logged.
TNrN  rP  s     rf   enableLogger.enable~  s    , 	d+rp   )rX   rR   rY   rZ   
activationc                   Ub  U R                  5         O/ nUb  U H  nU R                  " S0 UD6  M     Ub/  U R                  R                     X@R                  l        SSS5        Ubh  U R                  R                     U R                  R
                  R                  5         U R                  R
                  R                  U5        SSS5        Ub6  U H0  u  pxU(       a  U R                  U5        M  U R                  U5        M2     U Vs/ s H  o`R                  " S0 UD6PM     sn$ ! , (       d  f       N= f! , (       d  f       Nz= fs  snf )uE  Configure the core logger.

It should be noted that ``extra`` values set using this function are available across all
modules, so this is the best way to set overall default values.

To load the configuration directly from a file, such as JSON or YAML, it is also possible to
use the |loguru-config|_ library developed by `@erezinman`_.

Parameters
----------
handlers : |list| of |dict|, optional
    A list of each handler to be added. The list should contain dicts of params passed to
    the |add| function as keyword arguments. If not ``None``, all previously added
    handlers are first removed.
levels : |list| of |dict|, optional
    A list of each level to be added or updated. The list should contain dicts of params
    passed to the |level| function as keyword arguments. This will never remove previously
    created levels.
extra : |dict|, optional
    A dict containing additional parameters bound to the core logger, useful to share
    common properties if you call |bind| in several of your files modules. If not ``None``,
    this will remove previously configured ``extra`` dict.
patcher : |callable|_, optional
    A function that will be applied to the record dict of each logged messages across all
    modules using the logger. It should modify the dict in-place without returning anything.
    The function is executed prior to the one possibly added by the |patch| method. If not
    ``None``, this will replace previously configured ``patcher`` function.
activation : |list| of |tuple|, optional
    A list of ``(name, state)`` tuples which denotes which loggers should be enabled (if
    ``state`` is ``True``) or disabled (if ``state`` is ``False``). The calls to |enable|
    and |disable| are made accordingly to the list order. This will not modify previously
    activated loggers, so if you need a fresh start prepend your list with ``("", False)``
    or ``("", True)``.

Returns
-------
:class:`list` of :class:`int`
    A list containing the identifiers of added sinks (if any).

Examples
--------
>>> logger.configure(
...     handlers=[
...         dict(sink=sys.stderr, format="[{time}] {message}"),
...         dict(sink="file.log", enqueue=True, serialize=True),
...     ],
...     levels=[dict(name="NEW", no=13, icon="¤", color="")],
...     extra={"common_to_all": "default"},
...     patcher=lambda record: record["extra"].update(some_value=42),
...     activation=[("my_module.secret", False), ("another_library.module", True)],
... )
[1, 2]

>>> # Set a default "extra" dict to logger across all modules, without "bind()"
>>> extra = {"context": "foo"}
>>> logger.configure(extra=extra)
>>> logger.add(sys.stderr, format="{extra[context]} - {message}")
>>> logger.info("Context without bind")
>>> # => "foo - Context without bind"
>>> logger.bind(context="bar").info("Suppress global context")
>>> # => "bar - Suppress global context"
Nr{   )r   re   r   rc   rZ   rY   clearrs   rT  rQ  r   )	rd   rX   rR   rY   rZ   rV  paramsr)   rm   s	            rf   	configureLogger.configure  s   ~ KKMH 

$V$ ! %,

" ! 

  &&(

  ''. ! !)KK%LL&	  * 2::v"6":: ! ! ;s   D- A
D>E-
D;>
Ec           
      h  ^ Tb6  [        T[        5      (       d!  [        S[        T5      R                  -  5      eU R
                  R                     U R
                  R                  R                  5       nTc<  U H  nUb  M  X#U'   M     X R
                  l	        X0R
                  l         S S S 5        g TS:w  a  TS-  mU R
                  R                   VVs/ s H  u  pEUS [        T5       T:w  d  M  XE4PM     nnn[        U4S jU 5       S 5      nXr:w  a1  TS:X  a  USL d&  UR                  TU45        S nUR                  USS9  U H#  nUc  M  US-   S [        T5       T:X  d  M  X#U'   M%     X`R
                  l
        X0R
                  l        S S S 5        g s  snnf ! , (       d  f       g = f)Nz8Invalid name, it should be a string (or None), not: '%s'r;   r   c              3   T   >#    U  H  u  pTS [        U5       U:X  d  M  Uv   M     g 7frr   )r   )r   nsr)   s      rf   r   ,Logger._change_activation.<locals>.<genexpr>  s'     !W4#a&>UVCV!!s   (	(Tc                 *    U S   R                  S5      $ )Nr   r   )count)xs    rf   modules_depth0Logger._change_activation.<locals>.modules_depth  s    Q4::c?*rp   )keyreverse)r   r   r   r   rv   r   rc   r]   rk   r_   r^   r   r   appendsort)	rd   r)   statusr]   r^  r_  r^   parent_statusrd  s	    `       rf   rO  Logger._change_activation  s   
4 5 5JTRVZM`M``  ZZ__jj((--/G| Ay%+
 ! .4

*%,

" _ rz $(::#=#=#=41;SYSWAW#=   !!W!WY]^M&
v~&&f~6+  $$$E=a#g{T%;t%C!'AJ  *9JJ&!(JJA _ _s=   .F#)F#5$F#F5F<AF#F#,(F#F##
F1i   )castchunkc             #   ,  ^ ^#    [        T [        [        45      (       a  [        R                  U 4S j5       nOf[        T S5      (       a4  [        T R                  5      (       a  [        R                  U 4S j5       nO![        S[        T 5      R                  -  5      e[        T[        5      (       a  U4S jnO4[        T5      (       a  TnO![        S[        T5      R                  -  5      e [        R                  " U5      nU" 5        n[        R                  XvU5      nU H  n	U	R!                  5       n
U" U
5        U
v   M!     SSS5        g! [         a#    [        S[        U5      R                  -  5      Sef = f! , (       d  f       g= f7f)	a  Parse raw logs and extract each entry as a |dict|.

The logging format has to be specified as the regex ``pattern``, it will then be
used to parse the ``file`` and retrieve each entry based on the named groups present
in the regex.

Parameters
----------
file : |str|, |Path| or |file-like object|_
    The path of the log file to be parsed, or an already opened file object.
pattern : |str| or |re.Pattern|_
    The regex to use for logs parsing, it should contain named groups which will be included
    in the returned dict.
cast : |callable|_ or |dict|, optional
    A function that should convert in-place the regex groups parsed (a dict of string
    values) to more appropriate types. If a dict is passed, it should be a mapping between
    keys of parsed log dict and the function that should be used to convert the associated
    value.
chunk : |int|, optional
    The number of bytes read while iterating through the logs, this avoids having to load
    the whole file in memory.

Yields
------
:class:`dict`
    The dict mapping regex named groups to matched values, as returned by |match.groupdict|
    and optionally converted according to ``cast`` argument.

Examples
--------
>>> reg = r"(?P<lvl>[0-9]+): (?P<msg>.*)"    # If log format is "{level.no} - {message}"
>>> for e in logger.parse("file.log", reg):  # A file line could be "10 - A debug message"
...     print(e)                             # => {'lvl': '10', 'msg': 'A debug message'}

>>> caster = dict(lvl=int)                   # Parse 'lvl' key as an integer
>>> for e in logger.parse("file.log", reg, cast=caster):
...     print(e)                             # => {'lvl': 10, 'msg': 'A debug message'}

>>> def cast(groups):
...     if "date" in groups:
...         groups["date"] = datetime.strptime(groups["date"], "%Y-%m-%d %H:%M:%S")
...
>>> with open("file.log") as file:
...     for log in logger.parse(file, reg, cast=cast):
...         print(log["date"], log["something_else"])
c               3   r   >#    [        [        T5      5       n U v   S S S 5        g ! , (       d  f       g = f7frr   )openr   )fileobjfiles    rf   openerLogger.parse.<locals>.openerJ  s!     #d)_!M %__s   7&	7
47readc               3      >#    T v   g 7frr   r{   )rs  s   rf   rt  ru  Q  s     
s   	zDInvalid file, it should be a string path or a file object, not: '%s'c                 ^   > TR                  5        H  u  pX;   d  M  U" X   5      X'   M     g rr   )rS   )groupsrf  	converterrm  s      rf   cast_function#Logger.parse.<locals>.cast_function]  s(    &*jjlNC}&/&< '3rp   z:Invalid cast, it should be a function or a dict, not: '%s'zEInvalid pattern, it should be a string or a compiled regex, not: '%s'N)r   r   r&   
contextlibcontextmanagerr   r   rv  r   r   rv   r   recompiler}   
_find_iter	groupdict)rs  patternrm  rn  rt  r{  regexrr  matchesmatchry  s   ` `        rf   parseLogger.parse  sf    ` dS(O,,&&" '" T6""x		':':&& ' Vt*%%& 
 dD!!=
 d^^ MLtTXzObObb 	JJw'E X''>G *f% ! X  	Ww-(() 	 Xs6   C,F1E F<F
	F-F  F
FFc              #   "  #    U R                  S5      n U R                  U5      nX4-  n[        UR                  U5      5      nU(       d  U S h  vN   g [        U5      S:  a$  US   R	                  5       nX6S  nUS S  S h  vN   Mv   N: N7f)Nr   r   r/  )rv  r   finditerr   end)rr  r  rn  buffertextr  r  s          rf   r  Logger._find_itery  s     a<<&DNF5>>&12G"""7|abkoo'"3B<''  # (s$   ABB3BBBBc                 	   U R                   nUR                  (       d  g  UR                  U   u  ppXR                  :  a  g Uu	  pnnnnnnn [        US-   5      nUR                  nUR                  nUR                  R                   nUR                  R"                  n US	   n UR$                  U   (       d  g  [-        5       n [/        U5      n![1        5       n"[3        5       n#U [4        -
  n$U(       aq  [        U[6        5      (       a  [        U5      XR8                  n'n&n%O5[        U[:        5      (       a  Uu  n%n&n'O[<        R>                  " 5       u  n%n&n'[A        U%U&U'5      nOS nU$U0 URB                  E[D        RG                  5       EUE[I        U!U5      U[K        XU5      U[        U5      [M        U!5      S   U[O        U#RP                  U#RR                  5      [U        U"RP                  U"RR                  5      U S.n(U(       aB  U V)s/ s H
  n)U)" 5       PM     nn)URW                  5        V*V&s0 s H  u  n*n&U*U&" 5       _M     nn*n&U(       a  U(       a  U(S   RY                  U5        U(       a   SU;   a  [	        S5      eURY                  U(S9  U(       aU  U(       d  U(       a  [Z        R\                  " XEU5      n+O[Z        R^                  " [        U5      5      n+U+R`                  U(S'   O(U(       d  U(       a  S n+URb                  " U0 UD6U(S'   OS n+URd                  (       a  URe                  U(5        U H  n,U," U(5        M     UR                  Rg                  5        H  n-U-Ri                  U(XUU+5        M     g ! [        [        4 a    [        U[        5      (       a  [        SU-  5      S e[        U[        5      (       d"  [	        S[        U5      R                  -  5      S eUS:  a  [        SU-  5      S eS SU-  US4nUu  ppXR                  U'    GNf = f! [         a    0 nSnSnSn GNf = f! [         a    S n GNf = f! [         as    UR$                  nUc  UR&                  nUUU'   U(       d   g  GNUS
-   nUR(                   H)  u  nnUS [+        U5       U:X  d  M  U(       a    O
SUU'      g    SUU'    GNf = fs  sn)f s  sn&n*f )NrF  r   r   r   zLevel %drG  r,  z	<unknown>rv   r   FT)elapsedr   rY   rs  r  re   liner  r   r)   processthreadtimerY   r   zThe message can't be formatted: 'record' shall not be used as a keyword argument while logger has been configured with '.opt(record=True)')r   r  )5r   rX   rV   rH  r   r   r   r   r   r   rv   r\   r   	f_globalsf_linenof_codeco_namer   r]   r_   r^   r   r   r
   r   r   
start_timer(  __traceback__tuplesysexc_infor   rY   r   r;  r   r   r   r   identr)   r   rS   rs   r   prepare_messageprepare_simple_messagestrippedr   rZ   r   emit).rd   re   r  r  r  r  r   r   level_id
level_namelevel_no
level_iconcacher   r   r   r   r   r   r   r   rY   framer  r  r  r   r)   r]   rj  dotted_namedotted_module_namecurrent_datetime	file_namer  r  r  r  r  	traceback
log_recordargrf  colored_messagerZ   r   s.                                                 rf   r  Logger._log  s   zz}}	.9=9K9KE9R6H(" nn$RYO64gx	3eai(E I~~Hll**G,,22K	Z(D	%<<% && %;[)	!!#"Z/)]33+/	?IG^G^iuiIu--*3'ui*-,,.'ui'ui@II "=

=gkkm=u=y+6 zB7|y)!,$W]]GLLA"6<<=$

  %)*TcCETD*5;\\^D^zsEc57l^FDvw&&v.6!Y  MMM,v"+";";G6"R"+"B"B3w<"P$3$<$<Jy!V"O$+NND$CF$CJy!"O<<LL$GJ   }}++-GLLXsOT .} )$ 	.%%% !<u!DE4OeS))S5k**+  qy SV[[ :-uc:E9>6H((-u%	..  	&IH!G%K		&  	D	  	%llG|-- &  #Sj262F2F.&"#<S);%<=ASS!!(- 3G !%	%h +Dsf   M? P" !P; 'Q S1S?BPP"P87P8;Q
Q1S'S/S S
Sc                 B    U R                  SSU R                  XU5        g)zBLog ``message.format(*args, **kwargs)`` with severity ``'TRACE'``.r4   FNr  r   r7  _Logger__messager  r   s       rf   traceLogger.trace      GUFOOYfMrp   c                 B    U R                  SSU R                  XU5        g)zBLog ``message.format(*args, **kwargs)`` with severity ``'DEBUG'``.r5   FNr  r  s       rf   debugLogger.debug  r  rp   c                 B    U R                  SSU R                  XU5        g)zALog ``message.format(*args, **kwargs)`` with severity ``'INFO'``.r6   FNr  r  s       rf   infoLogger.info  s    FE6??IVLrp   c                 B    U R                  SSU R                  XU5        g)zDLog ``message.format(*args, **kwargs)`` with severity ``'SUCCESS'``.r7   FNr  r  s       rf   successLogger.success       IufooyOrp   c                 B    U R                  SSU R                  XU5        g)zDLog ``message.format(*args, **kwargs)`` with severity ``'WARNING'``.r8   FNr  r  s       rf   warningLogger.warning$  r  rp   c                 B    U R                  SSU R                  XU5        g)zBLog ``message.format(*args, **kwargs)`` with severity ``'ERROR'``.r9   FNr  r  s       rf   errorLogger.error(  r  rp   c                 B    U R                  SSU R                  XU5        g)zELog ``message.format(*args, **kwargs)`` with severity ``'CRITICAL'``.r:   FNr  r  s       rf   criticalLogger.critical,  s    Jv	Prp   c                 P    SU R                   SS -   nU R                  SSXAX#5        g)zRLog an ``'ERROR'```` message while also capturing the currently handled exception.)Tr   Nr9   F)r   r  )r7  r  r  r   r  s        rf   r   Logger.exception0  s)    FOOAB//GUGErp   c                 B    U R                  USU R                  X#U5        g)z@Log ``message.format(*args, **kwargs)`` with severity ``level``.FNr  )r7  _Logger__levelr  r  r   s        rf   log
Logger.log5  r  rp   c                 Z    [         R                  " S[        SS9  U R                  " U0 UD6$ )a  Add a handler sending log messages to a sink adequately configured.

Deprecated function, use |add| instead.

Warnings
--------
.. deprecated:: 0.2.2
  ``start()`` will be removed in Loguru 1.0.0, it is replaced by ``add()`` which is a less
  confusing name.
z>The 'start()' method is deprecated, please use 'add()' insteadr,  r-  )r0  r1  r2  r   rd   r  r   s      rf   startLogger.start9  s/     	L	

 xx(((rp   c                 Z    [         R                  " S[        SS9  U R                  " U0 UD6$ )a	  Remove a previously added handler and stop sending logs to its sink.

Deprecated function, use |remove| instead.

Warnings
--------
.. deprecated:: 0.2.2
  ``stop()`` will be removed in Loguru 1.0.0, it is replaced by ``remove()`` which is a less
  confusing name.
z@The 'stop()' method is deprecated, please use 'remove()' insteadr,  r-  )r0  r1  r2  r   r  s      rf   r   Logger.stopK  s/     	N	

 {{D+F++rp   r   rr   )NNN)2rv   rw   rx   ry   __doc__rg   r   r   LOGURU_LEVELLOGURU_FORMATLOGURU_FILTERLOGURU_COLORIZELOGURU_SERIALIZELOGURU_BACKTRACELOGURU_DIAGNOSELOGURU_ENQUEUELOGURU_CONTEXTLOGURU_CATCHr   r   r   	Exceptionr   r3  r8  r}  r~  r@  rC  re   rQ  rT  rZ  rO  staticmethodr  r  r  r  r  r  r  r  r  r  r   r  r  r   rz   r{   rp   rf   r}   r}      s   ,`R $$&&&&**,,,,**(((($$GR.`?$F j @j^ b_H"CH *% *%X/IbeN-0,0 %)T4\` X;t&)P %'u ^ ^@ ( ("GURNNMPPNQF
N)$,rp   r}   )Dr  r   r}  r   r   r  r  r`   r0  collectionsr   inspectr   r   r   multiprocessingr   r   multiprocessing.contextr	   os.pathr
   r   r   r;   r   r   r   r   _better_exceptionsr   
_colorizerr   _contextvarsr   	_datetimer   _error_interceptorr   
_file_sinkr   
_get_framer   _handlerr   _locks_machineryr   	_recattrsr   r   r   r   r   _simple_sinksr    r!   r"   r#   version_infoosr&   pathlibr'   r(   r  r   r1   r}   r{   rp   rf   <module>r     s   Tl     	 
   " E E 8 / & $ ; ; 2 ! $   0   !  0 \ \ L Lv, 	7;<[

%r
2R) R)jF, F,rp   