mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 08:12:17 +09:00
#17630622 * 디버그 메시지 출력 코드 정리
* __DEBUG__ 상수의 기본 값(0)에서는 어떠한 메시지도 출력하지 않도록 변경 * __DEBUG__ 상수의 순차적 증가 값을 비트 값으로 변경 * config/config.inc.php 파일의 설정 값 보다 우선하는 config/config.user.inc.php 를 먼저 읽도록 추가 * DisplayHandler::_debugOutput()에서 debugPrint()를 사용하지 않도록 변경 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@5339 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
27431fb123
commit
2f2578e7f8
3 changed files with 196 additions and 162 deletions
|
|
@ -395,40 +395,44 @@
|
|||
* ./files/_debug_message.php 파일에 $buff 내용을 출력한다.
|
||||
* tail -f ./files/_debug_message.php 하여 계속 살펴 볼 수 있다
|
||||
**/
|
||||
function debugPrint($buff = null, $display_option = true) {
|
||||
function debugPrint($debug_output = null, $display_option = true) {
|
||||
if(!(__DEBUG__ & 1)) return;
|
||||
|
||||
static $firephp;
|
||||
$bt = debug_backtrace();
|
||||
if(is_array($bt)) $first = array_shift($bt);
|
||||
$file_name = array_pop(explode(DIRECTORY_SEPARATOR, $first['file']));
|
||||
$line_num = $first['line'];
|
||||
|
||||
if(__DEBUG_OUTPUT__ == 0 || (__DEBUG_OUTPUT__ == 2 && version_compare(phpversion(), '5.2', '>') != 1) ) {
|
||||
$debug_file = _XE_PATH_.'files/_debug_message.php';
|
||||
$buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
|
||||
|
||||
if($display_option === true) $buff = "\n====================================\n".$buff."------------------------------------\n";
|
||||
$buff = "\n<?php\n/*".$buff."*/\n?>\n";
|
||||
if(@!$fp = fopen($debug_file, 'a')) return;
|
||||
fwrite($fp, $buff);
|
||||
fclose($fp);
|
||||
|
||||
} elseif(__DEBUG_OUTPUT__ == 2 && version_compare(phpversion(), '5.2', '>') == 1) {
|
||||
if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '5.2.0', '>=')) {
|
||||
if(!isset($firephp)) $firephp = FirePHP::getInstance(true);
|
||||
$label = sprintf('%s:%d', $file_name, $line_num);
|
||||
// FirePHP 옵션
|
||||
if($display_option === 'TABLE') {
|
||||
$label = $display_option;
|
||||
}
|
||||
$label = sprintf('[%s:%d] ', $file_name, $line_num);
|
||||
|
||||
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
|
||||
$buff = '허용되지 않은 IP 입니다. config/config.inc.php 파일의 __DEBUG_PROTECT_IP__ 상수 값을 자신의 IP로 변경하세요.';
|
||||
// FirePHP 옵션 체크
|
||||
if($display_option === 'TABLE') $label = $display_option;
|
||||
|
||||
// __DEBUG_PROTECT__ 옵션으로 지정된 IP와 접근 IP가 동일한지 체크
|
||||
if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
|
||||
$debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
|
||||
$label = null;
|
||||
}
|
||||
|
||||
$firephp->fb($buff, $label);
|
||||
$firephp->fb($debug_output, $label);
|
||||
|
||||
} else {
|
||||
$debug_file = _XE_PATH_.'files/_debug_message.php';
|
||||
$debug_output = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($debug_output, true));
|
||||
|
||||
if($display_option === true) $debug_output = str_repeat('=', 40)."\n".$debug_output.str_repeat('-', 40);
|
||||
$debug_output = "\n<?php\n/*".$debug_output."*/\n?>\n";
|
||||
|
||||
if(@!$fp = fopen($debug_file, 'a')) return;
|
||||
fwrite($fp, $debug_output);
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief microtime() return
|
||||
* @return float
|
||||
|
|
@ -721,4 +725,4 @@
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue