3 ”Reã @sfdZddlZddlZy ddlZWnek r8dZYnXdd„ZGdd„dejƒZejfdd„Z dS) zONicer log formatting with colours. Code copied from Tornado, Apache licensed. éNc CsVd}trRttjdƒrRtjjƒrRytjƒtjdƒdkr:d}Wntk rPYnX|S)NFÚisattyÚcolorsrT)ÚcursesÚhasattrÚsysÚstderrrZ setuptermZtigetnumÚ Exception)Úcolor©r úŠ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/pep517/colorlog.pyÚ_stderr_supports_colorsr c@s>eZdZdZejdejdejdejdiZ d dd„Z d d „Z dS) Ú LogFormatterz&Log formatter with colour support éééTNcCsÎtjj||d�i|_|r¾tƒr¾tjdƒp6tjdƒp6d}d tjkoLdknr\t |dƒ}x.|j j ƒD] \}}t tj ||ƒdƒ|j|<qhWt tjd ƒdƒ|_ tjƒ}|jƒd |_tjƒn d|_ d |_d S)aO :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. )ÚdatefmtZsetafZsetfÚrrrÚasciiZsgr0réFN)rr)rrr)ÚloggingÚ FormatterÚ__init__Ú_colorsr rZtigetstrrÚ version_infoÚstrÚDEFAULT_COLORSÚitemsZtparmÚ_normalZinitscrZgetmaxyxÚ termwidthZendwin)Úselfr rZfg_colorÚlevelnoÚcodeZscrr r r r2s     zLogFormatter.__init__cCsŒt|jƒ}dj|jd|jd�}|t|ƒ|jkrJd|j|t|ƒ}nd}|j|jkrn|j|j}|j}nd}}|j||||S)Nz{initial}-{name}r)ÚinitialÚnameú z r) ÚlenÚmessageÚformatÚ levelnamer#rr rr)rÚrecordÚmlenZ right_textÚspaceZ start_colorZ end_colorr r r Ú formatMessage]s     zLogFormatter.formatMessage)TN) Ú__name__Ú __module__Ú __qualname__Ú__doc__rÚINFOÚWARNINGÚERRORÚCRITICALrrr,r r r r r (s  +r cCs0tjƒ}|jtƒƒtjj|ƒtjj|ƒdS)N)rÚ StreamHandlerÚ setFormatterr ÚrootÚ addHandlerÚsetLevel)ÚlevelÚhandlerr r r Úenable_colourful_outputos  r<) r0rrrÚ ImportErrorr rr r1r<r r r r Ús   G