MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 18.117.158.174
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/libexec/kcare/python/kcarectl/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/libexec/kcare/python/kcarectl/log_utils.pyc
�
,w�gc@s�ddlmZddlZddlZddlZddlZddlZddlmZddlm	Z	ej
d�Zd�Ze
d�Ze
d	�Ze
d
�Ze
d�Zdd�Zd
�Zd�Zd�Zde
d�ZdS(i����(tprint_functionNi(tconfig(t	constantstkcarecCs!t|tj�tj|�dS(N(t	_printlvlRtPRINT_DEBUGtkcarelogtdebug(tmessage((s//usr/libexec/kcare/python/kcarectl/log_utils.pytlogdebugscCs*|rt|tj�ntj|�dS(N(RRt
PRINT_INFORtinfo(Rt	print_msg((s//usr/libexec/kcare/python/kcarectl/log_utils.pytloginfoscCs3|r"t|tjdtj�ntj|�dS(Ntfile(RRt
PRINT_WARNtsyststderrRtwarning(RR((s//usr/libexec/kcare/python/kcarectl/log_utils.pytlogwarn!scCs3|r"t|tjdtj�ntj|�dS(NR(RRtPRINT_ERRORRRRterror(RR((s//usr/libexec/kcare/python/kcarectl/log_utils.pytlogerror'scCs6|r%tjtjkr%tj�ntj|�dS(N(RRRtPRINT_LEVELt	tracebackt	print_excRt	exception(RR((s//usr/libexec/kcare/python/kcarectl/log_utils.pytlogexc-s
cCs&|tjkr"t|d|�ndS(NR(RRtprint(RtlevelR((s//usr/libexec/kcare/python/kcarectl/log_utils.pyR3scCsTtjd�}tjjdddtjjj�}|jtj�|j|�|S(Ns kcare %(levelname)s: %(message)staddresss/dev/logtfacility(tloggingt	Formatterthandlerst
SysLogHandlertLOG_USERtsetLeveltINFOtsetFormatter(tsyslog_formattertsyslog_handler((s//usr/libexec/kcare/python/kcarectl/log_utils.pytget_syslog_handler8s
$
cCs�tjd�}tj�dkrltjjtjdddd�}|jt	|tj
��|j|�|Stj�}|j|�|j|�|SdS(Ns&%(asctime)s %(levelname)s: %(message)sitmaxBytesiitbackupCounti(
R R!tostgetuidR"tRotatingFileHandlerRtLOG_FILER%tminR&R't
StreamHandler(Rtkcare_formattert
kcare_handler((s//usr/libexec/kcare/python/kcarectl/log_utils.pytget_kcare_handler@s	


cCs�gtj(yt|�}tj|�Wn tk
rI}tj|�nXtjjd�r�yt	�}tj|�Wq�tk
r�}tj|�q�XndS(Ns/dev/log(
RR"R5t
addHandlert	ExceptionRR-tpathtexistsR*(RR4texR)((s//usr/libexec/kcare/python/kcarectl/log_utils.pytinitialize_loggingQs
	cCs/|p	d}tdj|t|��|�dS(Ns<route cannot be logged>s8Unable to fetch {0}. Please try again later (error: {1})(Rtformattstr(R:turltstdout((s//usr/libexec/kcare/python/kcarectl/log_utils.pytprint_cln_http_errorbs(t
__future__RR tlogging.handlersR-RRtRRt	getLoggerRR	tTrueR
RRRtNoneRR*R5R;R@(((s//usr/libexec/kcare/python/kcarectl/log_utils.pyt<module>s$				

MMCT - 2023