示例#1
0
 protected static function log($identity, $request, $result)
 {
     $time = time();
     $agent = $identity['id'];
     $haddr = self::hash($identity['addr']);
     $fingerprint = $identity['fingerprint'];
     $connection = array();
     $connection['pid'] = getmypid();
     $connection['identity'] = $identity['id'];
     $connection['request'] = $request;
     $connection['time'] = $time;
     $connection['result'] = $result;
     $connection['start'] = microtime(true);
     // don't store connection details
     unset($connection['result'][2]);
     // Log connection
     self::$_connection = $connection;
     self::$_connectionKey = self::backend()->storeConnection($connection);
     foreach (self::$_namespaces as $ns) {
         $backend = self::backend();
         // Add agent to agents index
         $backend->indexAgent($agent, $ns);
         // Add agent to fingerprint agent index
         if (method_exists($backend, 'indexAgentFingerprint')) {
             $backend->indexAgentFingerprint($agent, $fingerprint, $ns);
         }
         // Add agent to host agent index
         if (method_exists($backend, 'indexAgentHost')) {
             $backend->indexAgentHost($agent, $haddr, $ns);
         }
         // Add connection to index
         self::backend()->indexConnection(self::$_connectionKey, $agent, $ns);
     }
 }