slowlog 를 원하는 아이피에서만 실행 하도록 개선

This commit is contained in:
qw5414 2016-02-01 08:03:03 +09:00
parent a37087f48c
commit 7e48ea11cf
2 changed files with 20 additions and 0 deletions

View file

@ -109,6 +109,25 @@ if(!defined('__LOG_SLOW_WIDGET__'))
define('__LOG_SLOW_WIDGET__', 0);
}
/**
* output comments of the slowlog files
*
* 0: No limit (not recommended)
* 1: Allow only specified IP addresses
*/
if(!defined('__LOG_SLOW_PROTECT__'))
{
define('__LOG_SLOW_PROTECT__', 1);
}
/**
* Set a ip address to allow slowlog
*/
if(!defined('__LOG_SLOW_PROTECT_IP__'))
{
define('__LOG_SLOW_PROTECT_IP__', '127.0.0.1');
}
/**
* Leave DB query information
*

View file

@ -822,6 +822,7 @@ function debugPrint($debug_output = NULL, $display_option = TRUE, $file = '_debu
function writeSlowlog($type, $elapsed_time, $obj)
{
if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
if(__LOG_SLOW_PROTECT__ === 1 && __LOG_SLOW_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) return;
static $log_filename = array(
'query' => 'files/_slowlog_query.php',