コード例 #1
0
ファイル: GraphiteStats.php プロジェクト: rukzuk/rukzuk
 /**
  * Helper to convert and add a ActionLog object
  * @param \Cms\Data\ActionLog $logEntry
  */
 public function addMetricByActionLogEntry($logEntry)
 {
     $action = $logEntry->getAction();
     $time = $logEntry->getTimestamp();
     $additional_info = json_decode($logEntry->getAdditionalinfo(), true);
     // default value is a counter
     $value = 1;
     // special values defined in the additionalinfo field
     if (isset($additional_info['metric_value'])) {
         if (isset($additional_info[$additional_info['metric_value']])) {
             $value = $additional_info[$additional_info['metric_value']];
         }
     }
     $this->addMetric($action, $value, $time);
 }
コード例 #2
0
ファイル: SegmentIoStats.php プロジェクト: rukzuk/rukzuk
 /**
  * Helper to convert and add an ActionLog object
  * @param string userId - the user to which this should be logged
  * @param \Cms\Data\ActionLog $logEntry
  * @return bool - the log entry was added or not (this can be affected by config blacklists)
  */
 public function addEventByActionLogEntry($userId, $logEntry)
 {
     $action = $logEntry->getAction();
     if (preg_match($this->cfg['action_blacklist_regex'], $action)) {
         return false;
     }
     $readable_action = $this->humanReadableActionName($action);
     $time = $logEntry->getTimestamp();
     $additional_info = json_decode($logEntry->getAdditionalinfo(), true);
     // add the 'special' params again (see Seitenbau\Logger\Action::logAction())
     $additional_info['id'] = $logEntry->getId();
     $additional_info['websiteId'] = $logEntry->getWebsiteid();
     $additional_info['name'] = $logEntry->getName();
     $filtered_info = $this->filterInfo($additional_info, $this->cfg['info_white_list']);
     // static event properties
     if ($logEntry->getUserlogin() !== 'unknown-userlogin') {
         $filtered_info['userLogin'] = $logEntry->getUserlogin();
     }
     $filtered_info['space'] = $this->getSpaceHost();
     $this->addEvent($readable_action, $userId, $filtered_info, $time);
     return true;
 }