<?PHP

if (!function_exists('byebye'))
{
function byebye($msg)
{
	global $logwogp;
	if (function_exists('error_get_last'))
	{
		if (($last=error_get_last()))
		{
			global $file;
			loggywoggy("The last error on $file was ".print_r($last,TRUE));
		}
	}
	if (isset($logwogp))
	{
		fwrite($logwogp,date("d M Y-H:i:s-")."Leaving $msg.\n\n");
		fclose($logwogp);
	}
}
}

if (!function_exists('loggywoggy'))
{
function loggywoggy($msg)
{
	global $logwogp;
	if (!isset($logwogp))
	{
		global $logdirectory,$logfilename;
		$logwogp=fopen("$logdirectory/$logfilename","a");
		register_shutdown_function("byebye",$_SERVER["PHP_SELF"]);
	}
	fwrite($logwogp,date("d M Y-H:i:s-").print_r($msg,TRUE)."\n");
	return;
}
}
if (!function_exists('buggywuggy'))
{
	function buggywuggy($msg)
	{
		loggywoggy($msg);
	}
}
?>
