HEX
Server: Apache
System: Linux 162-240-236-42.bluehost.com 3.10.0-1160.114.2.el7.x86_64 #1 SMP Wed Mar 20 15:54:52 UTC 2024 x86_64
User: bt667 (1004)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //usr/libexec/kcare/python/kcarectl/log_utils.pyc
�
��	ic@s�ddlmZddlZddlZddlZddlZddlZddlmZm	Z	ej
d�Zd�Ze
d�Ze
d�Ze
d	�Ze
d
�Zdd�Zd�Zd
�Zd�Zde
d�ZdS(i����(tprint_functionNi(tconfigt	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.pytlogwarnscCs3|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.pyR1scCsTtjd�}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_handler6s
$
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_loggingOs
	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_error`s(t
__future__RR tlogging.handlersR-RRtRRt	getLoggerRR	tTrueR
RRRtNoneRR*R5R;R@(((s//usr/libexec/kcare/python/kcarectl/log_utils.pyt<module>s"