Is there a way to create custom logs for the HTML-Kit Log Analyzer?
Answer 1.
function hklap_log($sLogFile, $sMyData = '', $sMyAgent = '', $sMyRef = '')
{
$sLogLine = date("m/d/Y H:i:s").", ".
$_SERVER['REMOTE_ADDR'].", ".
($sMyData ? $sMyData : $_SERVER['REQUEST_URI']).", ".
($sMyAgent ? $sMyAgent : $_SERVER['HTTP_USER_AGENT']).", ".
($sMyHost ? $sMyHost : $_SERVER['HTTP_HOST']).", ".
($sMyRef ? $sMyRef : $_SERVER['HTTP_REFERER'])."\r\n";
$file = fopen( $sLogFile, "a");
if($file)
{
flock($file, 2);
fputs($file, $sLogLine);
flock($file, 3);
fclose($file);
}
}
// log page requests:
hklap_log('mysite.log');
// add a log entry with custom data
// ($sResult contains a custom value from a script)
hklap_log('myScript.log', $sResult);
?>
Answer 2.