Exemplo n.º 1
0
 /**
  * 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}'");
 }
Exemplo n.º 2
0
 /**
  * Reads it's configuration from the 'profilelog'
  * section of the configuration
  */
 public function __construct()
 {
     if (self::$profilelogger != null) {
         return;
     }
     self::$profilelogger = new Zend_Log();
     $configs = api_config::getInstance()->profilelog;
     if (is_null($configs) || count($configs) == 0) {
         self::$profilelogger->addWriter(new Zend_Log_Writer_Null());
         return;
     }
     foreach ($configs as $cfg) {
         $log = $this->createLogObject($cfg['class'], $cfg);
         self::$profilelogger->addWriter($log);
     }
 }
Exemplo n.º 3
0
 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());
 }