ó
    Ñ]j1  ã                   ó¢  • S 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   SSK	r	 SSKrSSKJrJrJrJr  \R"                  " S5      r\R"                  " S5      r\R"                  " S5      rS	\4S
 jrS\S	\4S jr " S S\R2                  5      r SS\S\\R6                     S	S4S jjrSS\S	S4S jjrg! \
 a    Sr	 N�f = f! \
 a    Sr N¦f = f)aH  Logging support for Tornado.

Tornado uses three logger streams:

* ``tornado.access``: Per-request logging for Tornado's HTTP servers (and
  potentially other servers in the future)
* ``tornado.application``: Logging of errors from application code (i.e.
  uncaught exceptions from callbacks)
* ``tornado.general``: General-purpose logging, including any errors
  or warnings from Tornado itself.

These streams may be configured independently using the standard library's
`logging` module.  For example, you may wish to send ``tornado.access`` logs
to a separate file for analysis.
é    N)Ú_unicode)Úunicode_typeÚbasestring_type)ÚDictÚAnyÚcastÚOptionalztornado.accessztornado.applicationztornado.generalÚreturnc                  ó¤  •  [        [        R                  S5      (       a   [        R                  R                  5       (       a}  [        (       a2  [        R
                  " 5         [        R                  " S5      S:”  a  g g[        (       a5  [        R                  [        [        R                  S[        5       5      L a  gg! [         a     gf = f)NÚisattyÚcolorsr   TÚwrapped_stderrF)ÚhasattrÚsysÚstderrr   ÚcursesÚ	setuptermÚtigetnumÚcoloramaÚgetattrÚ
initialiseÚobjectÚ	Exception© ó    ÚH/home/mande/repo/quber/.venv/lib/python3.13/site-packages/tornado/log.pyÚ_stderr_supports_colorr   7   s¦   € ðÜ”3—:‘:˜x×(Ñ(¬S¯Z©Z×->Ñ->×-@Ñ-@ßŠvÜ× Ò Ô"Ü—?’? 8Ó,¨qÓ0Øð 1ð ÷ ’Ü—:‘:¤Ü×'Ñ'Ð)9¼6»8ó"ò ð  ð
 øô	 ó ð 	Øð	ús   ‚A<C Â?C Ã
CÃCÚsc                 óP   •  [        U 5      $ ! [         a    [        U 5      s $ f = f©N)r   ÚUnicodeDecodeErrorÚrepr)r   s    r   Ú_safe_unicoder#   J   s)   € ðÜ˜‹{ÐøÜó Ü�A‹wŠðús   ‚
 �%¤%c                   óè   • \ rS rSrSrSrSr\R                  S\R                  S\R                  S\R                  S\R                  S	0r\\S
S\4S\S\S\S\S\\\4   SS4S jjrS\S\4S jrSrg)ÚLogFormatteréQ   a0  Log formatter used in Tornado.

Key features of this formatter are:

* Color support when logging to a terminal that supports it.
* Timestamps on every log line.
* Robust against str/bytes encoding problems.

This formatter is enabled automatically by
`tornado.options.parse_command_line` or `tornado.options.parse_config_file`
(unless ``--logging=none`` is used).

Color support on Windows versions that do not support ANSI color codes is
enabled by use of the colorama__ library. Applications that wish to use
this must first initialize colorama with a call to ``colorama.init``.
See the colorama documentation for details.

__ https://pypi.python.org/pypi/colorama

.. versionchanged:: 4.5
   Added support for ``colorama``. Changed the constructor
   signature to be compatible with `logging.config.dictConfig`.
zV%(color)s[%(levelname)1.1s %(asctime)s %(module)s:%(lineno)d]%(end_color)s %(message)sz%y%m%d %H:%M:%Sé   é   é   é   é   Ú%TÚfmtÚdatefmtÚstyleÚcolorr   r
   Nc                 óp  • [         R                  R                  XS9  Xl        0 U l        U(       aþ  [        5       (       aï  [        bµ  [        R                  " S5      =(       d    [        R                  " S5      =(       d    SnUR                  5        H2  u  px[        [        R                  " Xh5      S5      U R                  U'   M4     [        R                  " S5      n	U	b  [        U	S5      U l        gSU l        gUR                  5        H  u  pxS	U-  U R                  U'   M     S
U l        gSU l        g)aø  
:arg bool color: Enables color support.
:arg str fmt: Log message format.
  It will be applied to the attributes dict of log records. The
  text between ``%(color)s`` and ``%(end_color)s`` will be colored
  depending on the level if color support is on.
:arg dict colors: color mappings from logging level to terminal color
  code
:arg str datefmt: Datetime format.
  Used for formatting ``(asctime)`` placeholder in ``prefix_fmt``.

.. versionchanged:: 3.2

   Added ``fmt`` and ``datefmt`` arguments.
)r.   NÚsetafÚsetfr   ÚasciiÚsgr0Ú z[2;3%dmz[0m)ÚloggingÚ	FormatterÚ__init__Ú_fmtÚ_colorsr   r   ÚtigetstrÚitemsr   ÚtparmÚ_normal)
Úselfr-   r.   r/   r0   r   Úfg_colorÚlevelnoÚcodeÚnormals
             r   r9   ÚLogFormatter.__init__t   sð   € ô. 	×Ñ×"Ñ" 4Ð"Ñ9ØŒ	àˆŒÞÔ+×-Ñ-ÜÑ!Ü!Ÿ?š?¨7Ó3×U´v·²ÀvÓ7N×UÐRU�à%+§\¡\¦^‘M�Gô -9ÜŸš XÓ4°gó-�D—L‘L Ó)ñ	 &4ô  Ÿš¨Ó0�ØÑ%Ü#/°¸Ó#@�D•Là#%�D•Lð &,§\¡\¦^‘M�GØ,9¸DÑ,@�D—L‘L Ó)ñ &4à(�•àˆD�Lr   Úrecordc                 ó„  •  UR                  5       n[        U[        5      (       d   e[        U5      Ul        U R                  U[        [        U R                  5      5      Ul        UR                  U R                  ;   a0  U R                  UR                     Ul        U R                  Ul        OS=Ul        Ul        U R"                  UR                  -  nUR$                  (       a1  UR&                  (       d   U R)                  UR$                  5      Ul        UR&                  (       aS  UR+                  5       /nUR-                  S UR&                  R/                  S5       5       5        SR1                  U5      nUR3                  SS5      $ ! [
         a$  nSU< SUR                  < 3Ul         S nAGN�S nAff = f)NzBad message (z): r6   c              3   ó8   #   • U  H  n[        U5      v •  M     g 7fr    )r#   )Ú.0Úlns     r   Ú	<genexpr>Ú&LogFormatter.format.<locals>.<genexpr>Ò   s   é € ÐQÒ5P¨rœ r×*Ð*Ò5Pùs   ‚Ú
z
    )Ú
getMessageÚ
isinstancer   r#   Úmessager   Ú__dict__Ú
formatTimer   Ústrr.   ÚasctimerB   r;   r0   r?   Ú	end_colorr:   Úexc_infoÚexc_textÚformatExceptionÚrstripÚextendÚsplitÚjoinÚreplace)r@   rF   rP   ÚeÚ	formattedÚliness         r   ÚformatÚLogFormatter.format¨   sV  € ð	IØ×'Ñ'Ó)ˆGÜ˜g¤×7Ñ7Ð7Ð7ô" +¨7Ó3ˆFŒNð Ÿ™¨´´c¸4¿<¹<Ó1HÓIˆŒà�>‰>˜TŸ\™\Ó)ØŸ<™<¨¯©Ñ7ˆFŒLØ#Ÿ|™|ˆFÕà.0Ð0ˆFŒL˜6Ô+à—I‘I §¡Ñ/ˆ	à�?�?Ø—?—?Ø"&×"6Ñ"6°v·±Ó"G�”Ø�?�?ð ×%Ñ%Ó'Ð(ˆEØ�L‰LÑQ°V·_±_×5JÑ5JÈ4Ô5PÓQÔQØŸ	™	 %Ó(ˆIØ× Ñ   xÓ0Ð0øô/ ó 	IØ,¨Q©E°°V·_±_Ñ4GÐHˆF�NŠNûð	Iús   ‚7F Æ
F?ÆF:Æ:F?)r;   r:   r?   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚDEFAULT_FORMATÚDEFAULT_DATE_FORMATr7   ÚDEBUGÚINFOÚWARNINGÚERRORÚCRITICALÚDEFAULT_COLORSrS   Úboolr   Úintr9   r   ra   Ú__static_attributes__r   r   r   r%   r%   Q   s·   † ñð0 n€NØ+Ðà�‰�qØ�‰�aØ�‰˜Ø�‰�qØ×Ñ˜!ð€Nð "Ø*ØØØ!/ñ2àð2ð ð2ð ð	2ð
 ð2ð �S˜#�X‘ð2ð 
õ2ðh,1˜Sð ,1 S÷ ,1r   r%   ÚoptionsÚloggerc                 óð  • U c  SSK nUR                  R                  n U R                  b  U R                  R                  5       S:X  a  gUc  [        R                  " 5       nUR                  [        [        U R                  R                  5       5      5        U R                  (       aÝ  U R                  nUS:X  a?  [        R                  R                  U R                  U R                  U R                  SS9nOcUS:X  aJ  [        R                  R                  U R                  U R                  U R                   U R                  SS9nOS	S
U-  -   n[#        U5      eUR%                  ['        SS95        UR)                  U5        U R*                  (       d  U R*                  cR  UR                  (       d@  [        R,                  " 5       nUR%                  ['        5       5        UR)                  U5        ggg)z Turns on formatted logging output as configured.

This is called automatically by `tornado.options.parse_command_line`
and `tornado.options.parse_config_file`.
Nr   ÚnoneÚsizezutf-8)ÚfilenameÚmaxBytesÚbackupCountÚencodingÚtime)rx   ÚwhenÚintervalrz   r{   z.The value of log_rotate_mode option should be z"size" or "time", not "%s".F)r0   )Útornado.optionsrs   r7   ÚlowerÚ	getLoggerÚsetLevelr   ÚupperÚlog_file_prefixÚlog_rotate_modeÚhandlersÚRotatingFileHandlerÚlog_file_max_sizeÚlog_file_num_backupsÚTimedRotatingFileHandlerÚlog_rotate_whenÚlog_rotate_intervalÚ
ValueErrorÚsetFormatterr%   Ú
addHandlerÚlog_to_stderrÚStreamHandler)rs   rt   ÚtornadoÚrotate_modeÚchannelÚerror_messages         r   Úenable_pretty_loggingr–   ×   s§  € ð �Ûà—/‘/×)Ñ)ˆØ‡�Ñ '§/¡/×"7Ñ"7Ó"9¸VÓ"CØØ�~Ü×"Ò"Ó$ˆØ
‡O�O”GœG W§_¡_×%:Ñ%:Ó%<Ó=Ô>Ø××Ø×-Ñ-ˆØ˜&Ó Ü×&Ñ&×:Ñ:Ø ×0Ñ0Ø ×2Ñ2Ø#×8Ñ8Ø ð	 ;ð ‰Gð ˜FÓ"Ü×&Ñ&×?Ñ?Ø ×0Ñ0Ø×,Ñ,Ø ×4Ñ4Ø#×8Ñ8Ø ð @ð ‰Gð AØ/°+Ñ=ñ>ð ô ˜]Ó+Ð+Ø×Ñœ\°Ñ6Ô7Ø×Ñ˜'Ô"à×× ×!6Ñ!6Ñ!>ÀvÇÇä×'Ò'Ó)ˆØ×Ñœ\›^Ô,Ø×Ñ˜'Õ"ð	 HWÐ!>r   c                 óÄ  ^ • T c  SSK nUR                  R                  m T R                  SSSSS9  T R                  S[        SS	S
9  T R                  S[        SSSS9  T R                  S[
        SSS
9  T R                  S[
        SSS
9  T R                  S[        SSS
9  T R                  S[
        SSS
9  T R                  S[        SSS
9  T R                  U 4S j5        g)a.  Add logging-related flags to ``options``.

These options are present automatically on the default options instance;
this method is only necessary if you have created your own `.OptionParser`.

.. versionadded:: 4.2
    This function existed in prior versions but was broken and undocumented until 4.2.
Nr   r7   ÚinfozSSet the Python log level. If 'none', tornado won't touch the logging configuration.zdebug|info|warning|error|none)ÚdefaultÚhelpÚmetavarr�   zŒSend log output to stderr (colorized if possible). By default use stderr if --log_file_prefix is not set and no other logging is configured.)Útyper™   rš   r„   ÚPATHz¥Path prefix for log files. Note that if you are running multiple tornado processes, log_file_prefix must be different for each of them (e.g. include the port number))rœ   r™   r›   rš   rˆ   i áõz%max size of log files before rolloverr‰   é
   znumber of log files to keepr‹   Úmidnightzcspecify the type of TimedRotatingFileHandler interval other options:('S', 'M', 'H', 'D', 'W0'-'W6')rŒ   r*   z$The interval value of timed rotatingr…   rw   z(The mode of rotating files(time or size)c                  ó   >• [        T 5      $ r    )r–   )rs   s   €r   Ú<lambda>Ú(define_logging_options.<locals>.<lambda>W  s   ø€ Ô'<¸WÔ'Er   )r   rs   Údefinerp   rS   rq   Úadd_parse_callback)rs   r’   s   ` r   Údefine_logging_optionsr¥   	  s.  ø€ ð �ãà—/‘/×)Ñ)ˆØ‡N�NØØð%ð 0ð ñ ð ‡N�NØÜØð.ð ñ 	ð ‡N�NØÜØØð'ð ñ ð ‡N�NØÜØ!Ø4ð	 ñ ð ‡N�NØ¤S°"Ð;Xð ñ ð ‡N�NØÜØð<ð ñ ð ‡N�NØÜØØ3ð	 ñ ð ‡N�NØÜØØ7ð	 ñ ð ×ÑÔEÕFr   )NNr    )rg   r7   Úlogging.handlersr   Útornado.escaper   Útornado.utilr   r   r   ÚImportErrorr   Útypingr   r   r   r	   r�   Ú
access_logÚapp_logÚgen_logrp   r   rS   r#   r8   r%   ÚLoggerr–   r¥   r   r   r   Ú<module>r¯      s  ðñó Û Û 
å #ß 6ðÛðÛ÷ -Ó ,ð ×ÒÐ/Ó0€
Ø
×
Ò
Ð1Ó
2€Ø
×
Ò
Ð-Ó
.€ð ô ð&�Sð ˜Sô ôC1�7×$Ñ$ô C1ðN =Añ/#Øð/#Ø!)¨'¯.©.Ñ!9ð/#à	õ/#ñdNG Cð NG°4ö NGøðE ó Ø‚Hðûð
 ó Ø‚Fðús"   žB5 £C Â5C Â?C ÃCÃC