%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/tornado/
Upload File :
Create Path :
Current File : //usr/lib64/python2.7/site-packages/tornado/log.pyc

�
��L]c@�sdZddlmZmZmZmZddlZddlZddlZddl	m
Z
ddlmZm
Z
yddlZWnek
r�dZnXejd�Zejd�Zejd�Zd	�Zd
�Zdejfd��YZddd
�Zdd�ZdS(sHLogging 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.
i(tabsolute_importtdivisiontprint_functiontwith_statementN(t_unicode(tunicode_typetbasestring_typestornado.accessstornado.applicationstornado.generalcC�stt}trpttjd�rptjj�rpy,tj�tjd�dkrXt}nWqpt	k
rlqpXn|S(Ntisattytcolorsi(
tFalsetcursesthasattrtsyststderrRt	setuptermttigetnumtTruet	Exception(tcolor((s1/usr/lib64/python2.7/site-packages/tornado/log.pyt_stderr_supports_color2s'


cC�s-yt|�SWntk
r(t|�SXdS(N(RtUnicodeDecodeErrortrepr(ts((s1/usr/lib64/python2.7/site-packages/tornado/log.pyt
_safe_unicode>s
tLogFormattercB�sfeZdZdZdZidej6dej6dej6dej	6Z
eeee
d�Zd�Z
RS(	sfLog 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` (unless ``--logging=none`` is
    used).
    sV%(color)s[%(levelname)1.1s %(asctime)s %(module)s:%(lineno)d]%(end_color)s %(message)ss%y%m%d %H:%M:%Siiiic	C�s�tjj|d|�||_i|_|r�t�r�tjd�pXtjd�pXd}dtj	koudknr�t
|d�}nx<|j�D].\}}t
tj||�d�|j|<q�Wt
tjd	�d�|_
n	d|_
d
S(
s^
        :arg bool color: Enables color support.
        :arg string 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 string datefmt: Datetime format.
          Used for formatting ``(asctime)`` placeholder in ``prefix_fmt``.

        .. versionchanged:: 3.2

           Added ``fmt`` and ``datefmt`` arguments.
        tdatefmttsetaftsetftiiitasciitsgr0N(ii(iii(tloggingt	Formattert__init__t_fmtt_colorsRR
ttigetstrRtversion_infoRtitemsttparmt_normal(tselfRtfmtRRtfg_colortlevelnotcode((s1/usr/lib64/python2.7/site-packages/tornado/log.pyR![s		&cC�sVy4|j�}t|t�s$t�t|�|_Wn)tk
r_}d||jf|_nX|j||j	�|_
|j|jkr�|j|j|_
|j|_nd|_
|_|j|j}|jr�|js�|j|j�|_q�n|jrF|j�g}|jd�|jjd�D��dj|�}n|jdd�S(NsBad message (%r): %rRcs�s|]}t|�VqdS(N(R(t.0tln((s1/usr/lib64/python2.7/site-packages/tornado/log.pys	<genexpr>�ss
s
    (t
getMessaget
isinstanceRtAssertionErrorRtmessageRt__dict__t
formatTimeRtasctimeR,R#RR(t	end_colorR"texc_infotexc_texttformatExceptiontrstriptextendtsplittjointreplace(R)trecordR3tet	formattedtlines((s1/usr/lib64/python2.7/site-packages/tornado/log.pytformat�s(			#(t__name__t
__module__t__doc__tDEFAULT_FORMATtDEFAULT_DATE_FORMATRtDEBUGtINFOtWARNINGtERRORtDEFAULT_COLORSRR!RD(((s1/usr/lib64/python2.7/site-packages/tornado/log.pyREs



'cC�s,|dkrddlm}n|jdksC|jj�dkrGdS|dkrbtj�}n|jtt|jj���|j	r�tj
jd|j	d|jd|j
�}|jtdt��|j|�n|js�|jdkr(|j
r(tj�}|jt��|j|�ndS(	s�Turns on formatted logging output as configured.

    This is called automatically by `tornado.options.parse_command_line`
    and `tornado.options.parse_config_file`.
    i(toptionstnoneNtfilenametmaxBytestbackupCountR(tNonettornado.optionsRORtlowert	getLoggertsetLeveltgetattrtuppertlog_file_prefixthandlerstRotatingFileHandlertlog_file_max_sizetlog_file_num_backupstsetFormatterRR	t
addHandlert
log_to_stderrt
StreamHandler(ROtloggertchannel((s1/usr/lib64/python2.7/site-packages/tornado/log.pytenable_pretty_logging�s&$				c
�s��dkrddlm�n�jddddddd	��jd
dtdddd��jd
dtdddddd��jddtdddd��jddtdddd��j�fd��dS(sBAdd 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.
    i(RORtdefaulttinfothelpsSSet the Python log level. If 'none', tornado won't touch the logging configuration.tmetavarsdebug|info|warning|error|noneRbttypes�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.R[tPATHs�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^idi�s%max size of log files before rolloverR_i
snumber of log files to keepc�s
t��S(N(Rf((RO(s1/usr/lib64/python2.7/site-packages/tornado/log.pyt<lambda>�sNi��i�(RTRUROtdefinetbooltstrtinttadd_parse_callback(RO((ROs1/usr/lib64/python2.7/site-packages/tornado/log.pytdefine_logging_options�s	(RGt
__future__RRRRRtlogging.handlersRttornado.escapeRttornado.utilRRR
tImportErrorRTRWt
access_logtapp_logtgen_logRRR RRfRs(((s1/usr/lib64/python2.7/site-packages/tornado/log.pyt<module>s$"

		m

Zerion Mini Shell 1.0