Created
March 5, 2014 07:44
-
-
Save alex-cory/9362851 to your computer and use it in GitHub Desktop.
This will show how many seconds it took to load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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