Jump to content

Debug Help Code


rick2302

Recommended Posts

To gain a view to what is going on when debugging, I set up this function which logs a string to a text file.It appends the string to an existing file or creates a new file if there is no file for that day:

function logString($_StringToLog){	$_fileName = date("Y-m-d") ."_log.txt";	$_timeStamp = date("h:i:s A");	$_sourceFile = $_SERVER['PHP_SELF'];	$_CR = chr(10);	$file = fopen($_fileName,"a");			fwrite($file,$_CR .$_timeStamp ." - " .$_sourceFile ." - " .$_StringToLog);	fclose($file);}

It's called by a lines like:

logString("Got to CheckName function");logString("Insert query: " .$query_insert);

I have found this immensely helpful and figured someone else would too.Enjoy!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...