Skip to content

Instantly share code, notes, and snippets.

@alex-cory
Created March 5, 2014 07:44
Show Gist options
  • Save alex-cory/9362851 to your computer and use it in GitHub Desktop.
Save alex-cory/9362851 to your computer and use it in GitHub Desktop.
This will show how many seconds it took to load
/**
* Write a line to a log file
*
* @param string $log destination of log file
* @param string $message message to log
* @return void
*/
function writeLog( $log , $message ) {
if (! file_exists( $log ) ) {
file_put_contents( $log , $message . "\n" );
} else {
file_put_contents( $log , $message . "\n" , FILE_APPEND | LOCK_EX );
}
}
// TO Invoke
$log = '/path/to/logs/log.log';
writeLog( $log , "--------" );
writeLog( $log , "Version submitted for processing at $changed.");
// Put this at the beginning of the file:
$start = microtime(TRUE);
// Put this at the end of the file:
$end = microtime(TRUE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment