mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1194 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4ecfe64485
commit
4c123b4395
9 changed files with 63 additions and 34 deletions
|
|
@ -652,7 +652,7 @@
|
|||
* @brief HtmlHeader 추가
|
||||
**/
|
||||
function _addHtmlHeader($header) {
|
||||
$this->html_header .= ($this->html_header?"\n":"").$header;
|
||||
$this->html_header .= "\n".$header;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -118,14 +118,14 @@
|
|||
* @brief 로그 남김
|
||||
**/
|
||||
function actStart($query) {
|
||||
if(!__DEBUG__) return;
|
||||
if(__DEBUG__ < 2) return;
|
||||
$this->setError(0,'success');
|
||||
$this->query = $query;
|
||||
$this->act_start = getMicroTime();
|
||||
}
|
||||
|
||||
function actFinish() {
|
||||
if(!__DEBUG__ || !$this->query) return;
|
||||
if(__DEBUG__ < 2 || !$this->query) return;
|
||||
$this->act_finish = getMicroTime();
|
||||
$elapsed_time = $this->act_finish - $this->act_start;
|
||||
$GLOBALS['__db_elapsed_time__'] += $elapsed_time;
|
||||
|
|
|
|||
|
|
@ -137,20 +137,26 @@
|
|||
/**
|
||||
* @brief 디버그 모드일 경우 디버기 메세지 출력
|
||||
*
|
||||
* __DEBUG__가 true일 경우 각 부분의 실행시간등을 debugPrint 함수를 이용해서 출력\n
|
||||
* 개발시나 테스트시에 config/config.inc.php의 __DEBUG__를 true로 세팅하고\n
|
||||
* __DEBUG__가 1이상일 경우 각 부분의 실행시간등을 debugPrint 함수를 이용해서 출력\n
|
||||
* 개발시나 테스트시에 config/config.inc.php의 __DEBUG__를 세팅하고\n
|
||||
* tail -f ./files/_debug_message.php로 하여 console로 확인하면 편리함\n
|
||||
**/
|
||||
function _debugOutput() {
|
||||
if(!__DEBUG__) return;
|
||||
$end = getMicroTime();
|
||||
|
||||
// debug string 작성 시작
|
||||
$buff = "\n\n** Debug at ".date('Y-m-d H:i:s')." ************************************************************\n";
|
||||
|
||||
// Request/Response 정보 작성
|
||||
$buff .= "\n- Request/ Response info\n";
|
||||
$buff .= sprintf("\tRequest URI \t\t\t: %s:%s%s%s%s\n", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']?'?':'', $_SERVER['QUERY_STRING']);
|
||||
$buff .= sprintf("\tRequest method \t\t\t: %s\n", $_SERVER['REQUEST_METHOD']);
|
||||
$buff .= sprintf("\tResponse method \t\t: %s\n", Context::getResponseMethod());
|
||||
$buff .= sprintf("\tResponse contents size\t\t: %d byte\n", $this->getContentSize());
|
||||
|
||||
// DB 로그 작성
|
||||
if(__DEBUG__>1) {
|
||||
if($GLOBALS['__db_queries__']) {
|
||||
$buff .= "\n- DB Queries\n";
|
||||
$buff .= $GLOBALS['__db_queries__'];
|
||||
|
|
@ -158,10 +164,17 @@
|
|||
$buff .= "\n- Elapsed time\n";
|
||||
|
||||
if($GLOBALS['__db_elapsed_time__']) $buff .= sprintf("\tDB queries elapsed time\t\t: %0.5f sec\n", $GLOBALS['__db_elapsed_time__']);
|
||||
}
|
||||
|
||||
// 기타 로그 작성
|
||||
if(__DEBUG__==3) {
|
||||
$buff .= sprintf("\tclass file load elapsed time \t: %0.5f sec\n", $GLOBALS['__elapsed_class_load__']);
|
||||
$buff .= sprintf("\tTemplate compile elapsed time\t: %0.5f sec\n", $GLOBALS['__template_elapsed__']);
|
||||
$buff .= sprintf("\tXmlParse compile elapsed time\t: %0.5f sec\n", $GLOBALS['__xmlparse_elapsed__']);
|
||||
$buff .= sprintf("\tPHP elapsed time \t\t: %0.5f sec\n", $end-__StartTime__-$GLOBALS['__template_elapsed__']-$GLOBALS['__xmlparse_elapsed__']-$GLOBALS['__db_elapsed_time__']-$GLOBALS['__elapsed_class_load__']);
|
||||
}
|
||||
|
||||
// 전체 실행 시간 작성
|
||||
$buff .= sprintf("\tTotal elapsed time \t\t: %0.5f sec", $end-__StartTime__);
|
||||
|
||||
debugPrint($buff, false);
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@
|
|||
$class_path = ModuleHandler::getModulePath($module);
|
||||
if(!$class_path) return NULL;
|
||||
|
||||
if(__DEBUG__) $start_time = getMicroTime();
|
||||
if(__DEBUG__==3) $start_time = getMicroTime();
|
||||
|
||||
// global 변수에 미리 생성해 둔 객체가 없으면 새로 생성
|
||||
if(!$GLOBALS['_loaded_module'][$module][$type]) {
|
||||
|
|
@ -298,7 +298,7 @@
|
|||
$GLOBALS['_loaded_module'][$module][$type] = $oModule;
|
||||
}
|
||||
|
||||
if(__DEBUG__) $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
|
||||
if(__DEBUG__==3) $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
|
||||
|
||||
// 객체 리턴
|
||||
return $GLOBALS['_loaded_module'][$module][$type];
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
$this->tpl_path = $tpl_path;
|
||||
|
||||
// 디버그를 위한 컴파일 시작 시간 저장
|
||||
if(__DEBUG__) $start = getMicroTime();
|
||||
if(__DEBUG__==3) $start = getMicroTime();
|
||||
|
||||
// 변수 체크
|
||||
$this->tpl_path = ereg_replace('(\/+)$', '', $this->tpl_path).'/';
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
// 일단 컴파일
|
||||
$buff = $this->_compile($tpl_file, $compiled_tpl_file);
|
||||
|
||||
if(__DEBUG__) $GLOBALS['__template_elapsed__'] += getMicroTime() - $start;
|
||||
if(__DEBUG__==3) $GLOBALS['__template_elapsed__'] += getMicroTime() - $start;
|
||||
|
||||
// Context와 compiled_tpl_file로 컨텐츠 생성
|
||||
$output = $this->_fetch($compiled_tpl_file, $buff);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
**/
|
||||
function parse($input = '') {
|
||||
// 디버그를 위한 컴파일 시작 시간 저장
|
||||
if(__DEBUG__) $start = getMicroTime();
|
||||
if(__DEBUG__==3) $start = getMicroTime();
|
||||
|
||||
$this->lang = Context::getLangType();
|
||||
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
$output = array_shift($this->output);
|
||||
|
||||
// 디버그를 위한 컴파일 시작 시간 저장
|
||||
if(__DEBUG__) $GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
|
||||
if(__DEBUG__==3) $GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
<!--@end--><script type="text/javascript">
|
||||
var zbxe_url = "{$zbxe_url}";
|
||||
</script>
|
||||
|
||||
{Context::getHtmlHeader()}
|
||||
|
||||
</head>
|
||||
|
|
|
|||
|
|
@ -16,13 +16,22 @@
|
|||
require_once("./config/func.inc.php");
|
||||
|
||||
/**
|
||||
* @brief debug mode = true 일때 files/_debug_message.php 에 디버그 내용이 쌓임
|
||||
* @brief 디버그 메세지의 출력 장소
|
||||
* 0 : files/_debug_message.php 에 연결하여 출력
|
||||
* 1 : Response Method 가 XML 형식이 아닐 경우 브라우저에 최상단에 주석으로 표시
|
||||
**/
|
||||
define('__DEBUG__', true);
|
||||
if(__DEBUG__) {
|
||||
// 여기서부터 시작 시간으로 설정
|
||||
define('__StartTime__', getMicroTime());
|
||||
}
|
||||
define('__DEBUG_OUTPUT__', 1);
|
||||
|
||||
/**
|
||||
* @brief 디버깅 메세지 출력
|
||||
* 0 : 디버그 메세지를 생성/ 출력하지 않음
|
||||
* 1 : 전체 실행 시간에 대해서만 메세지 생성/ 출력
|
||||
* 2 : 1 + DB 쿼리
|
||||
* 3 : 모든 로그
|
||||
**/
|
||||
define('__DEBUG__', 3);
|
||||
|
||||
if(__DEBUG__) define('__StartTime__', getMicroTime());
|
||||
|
||||
/**
|
||||
* @brief 기본적인 class 파일 include
|
||||
|
|
|
|||
|
|
@ -140,7 +140,12 @@
|
|||
* tail -f ./files/_debug_message.php 하여 계속 살펴 볼 수 있다
|
||||
**/
|
||||
function debugPrint($buff = null, $display_line = true) {
|
||||
if($buff == null) $buff = $GLOBALS['HTTP_RAW_POST_DATA'];
|
||||
if(!$buff) return;
|
||||
|
||||
if(__DEBUG_OUTPUT__==1) {
|
||||
$header = sprintf("<!--\n%s\n-->", print_r($buff,true));
|
||||
Context::addHtmlHeader($header);
|
||||
} else {
|
||||
$debug_file = "./files/_debug_message.php";
|
||||
$buff = sprintf("%s\n",print_r($buff,true));
|
||||
|
||||
|
|
@ -150,6 +155,7 @@
|
|||
fwrite($fp, $buff);
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief microtime() return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue