Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php custom error log

// You can easily create your own function to handle logging, like so:

/***
	Simple function to log a value to a text file
    Takes 1 parameter: the value to log to the file, as a STRING
***/
function log_data($value)
{
	define('LOG_FILE_PATH', 'form-data-log.txt'); // define the path to the file that you would like to have created (if it does not yet exist)
	$time_stamp = date("Y-m-d H:i:s"); // get the current time
	$file_pointer = fopen(LOG_FILE_PATH, 'a'); // open the log file (in 'append' mode)
  	fwrite($file_pointer, $time_stamp . " ---> " . $value . "
"); // log the value to the file
  	fclose($data_log); // ALWAYS remember to close the log file after writing to it!
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #custom #error #log
ADD COMMENT
Topic
Name
2+1 =