/** * Test we can put a message at the end of the profile log * and read it back */ function testLogWrite() { $configs = api_config::getInstance()->profilelog; $logfile = $this->getLogFileName(); $log = new binarypool_profilelog(); $token = sha1("testLog" . time()); $log->info("{$token}"); $lines = file($logfile); $this->assertPattern("#{$token}#", array_pop($lines), "Unable to file token '{$token}' at end of logfile '{$logfile}'"); }
protected function logRequest() { $log = new binarypool_profilelog(); $log->info("%s %s%s - Response time: %f seconds, Peak Mem Use: %s bytes", $this->request->getVerb(), empty($_SERVER['HTTP_HOST']) ? '' : 'http://' . $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'], microtime(true) - $this->viewStart, memory_get_peak_usage()); }