setTimestamp() public méthode

public setTimestamp ( integer $timestamp ) : GELFMessage
$timestamp integer
Résultat GELFMessage
Exemple #1
0
 /**
  * Places event line into array of lines to be used as message body.
  *
  * @param array $event Event data
  * @return void
  */
 protected function _write($event)
 {
     try {
         Mage::helper('hackathon_logger')->addEventMetadata($event);
         $eofMessageFirstLine = strpos($event['message'], "\n");
         $shortMessage = FALSE === $eofMessageFirstLine ? $event['message'] : substr($event['message'], 0, $eofMessageFirstLine);
         $msg = new GELFMessage();
         $msg->setTimestamp(microtime(TRUE));
         $msg->setShortMessage($shortMessage);
         if ($event['backtrace']) {
             $msg->setFullMessage($event['message'] . "\n\nBacktrace:\n" . $event['backtrace']);
         } else {
             $msg->setFullMessage($event['message']);
         }
         $msg->setHost(gethostname());
         $msg->setLevel($event['priority']);
         $msg->setFacility($this->_options['app_name'] . $this->_options['filename']);
         $msg->setFile($event['file']);
         $msg->setLine($event['line']);
         $msg->setAdditional('store_code', $event['store_code']);
         $msg->setAdditional('time_elapsed', $event['time_elapsed']);
         $msg->setHost(php_uname('n'));
         foreach (array('REQUEST_METHOD', 'REQUEST_URI', 'REMOTE_IP', 'HTTP_USER_AGENT') as $key) {
             if (!empty($event[$key])) {
                 $msg->setAdditional($key, $event[$key]);
             }
         }
         $this->_publisher->publish($msg);
     } catch (Exception $e) {
         throw new Zend_Log_Exception($e->getMessage(), $e->getCode());
     }
 }
 /**
  * Places event line into array of lines to be used as message body.
  *
  * @param array $event Event data
  * @throws Zend_Log_Exception
  */
 protected function _write($event)
 {
     try {
         $event = Mage::helper('firegento_logger')->getEventObjectFromArray($event);
         Mage::helper('firegento_logger')->addEventMetadata($event);
         $message = $event->getMessage();
         $eofMessageFirstLine = strpos($message, "\n");
         $shortMessage = false === $eofMessageFirstLine ? $message : substr($message, 0, $eofMessageFirstLine);
         $msg = new GELFMessage();
         $msg->setTimestamp(microtime(true));
         $msg->setShortMessage($shortMessage);
         if ($event->getBacktrace()) {
             $msg->setFullMessage($message . "\n\nBacktrace:\n" . $event->getBacktrace());
         } else {
             $msg->setFullMessage($message);
         }
         $msg->setHost(gethostname());
         $msg->setLevel($event->getPriority());
         $msg->setFacility($this->_options['app_name'] . $this->_options['filename']);
         $msg->setFile($event->getFile());
         $msg->setLine($event->getLine());
         $msg->setAdditional('store_code', $event->getStoreCode());
         $msg->setAdditional('time_elapsed', $event->getTimeElapsed());
         $msg->setHost(php_uname('n'));
         foreach (array('getRequestMethod', 'getRequestUri', 'getRemoteIp', 'getHttpUserAgent') as $method) {
             if (is_callable(array($event, $method)) && $event->{$method}()) {
                 $msg->setAdditional(lcfirst(substr($method, 3)), $event->{$method}());
             }
         }
         $this->_publisher->publish($msg);
     } catch (Exception $e) {
         throw new Zend_Log_Exception($e->getMessage(), $e->getCode());
     }
 }