configurable file logging

Respect CONST_Log_File setting and add two new configuration
variables CONST_Log_File_SearchLog and CONST_Log_File_ReverseLog
for the log file names.
This commit is contained in:
Sarah Hoffmann 2012-03-04 12:50:45 +01:00
parent d7e91469b7
commit 0005dc0a0f
2 changed files with 8 additions and 3 deletions

View File

@ -26,10 +26,11 @@
$oDB->query($sSQL);
}
if (CONST_Log_File && CONST_Log_File_ReverseLog != '') {
if ($sType == 'reverse')
{
$aStartTime = explode('.',$hLog[0]);
file_put_contents('/data/mapquest/opentile_http/logs/nominatimreverse',
file_put_contents(CONST_Log_File_ReverseLog,
$aStartTime[0].','.$aStartTime[1].','.
php_uname('n').','.
'"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'.
@ -41,7 +42,7 @@
'"'.addslashes($_GET['format']).'"'."\n",
FILE_APPEND);
}
}
return $hLog;
}
@ -67,8 +68,9 @@
$oDB->query($sSQL);
}
if (CONST_Log_File && CONST_Log_File_SearchLog != '') {
$aStartTime = explode('.',$hLog[0]);
file_put_contents('/data/mapquest/opentile_http/logs/nominatimsearch',
file_put_contents(CONST_Log_File_SearchLog,
$aStartTime[0].','.$aStartTime[1].','.
php_uname('n').','.
'"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'.
@ -78,5 +80,6 @@
'"'.addslashes($_GET['format']).'",'.
$iNumResults."\n",
FILE_APPEND);
}
}

View File

@ -34,3 +34,5 @@
@define('CONST_Log_DB', true);
@define('CONST_Log_File', false);
@define('CONST_Log_File_Format', 'TODO'); // Currently hard coded
@define('CONST_Log_File_SearchLog', '');
@define('CONST_Log_File_ReverseLog', '');