示例#1
0
 /**
  * Sends the log header
  *
  * @see sendHeader()
  */
 protected function send()
 {
     if (self::$overflowed || !self::$sendHeaders) {
         return;
     }
     if (!self::$initialized) {
         self::$initialized = true;
         self::$sendHeaders = $this->headersAccepted();
         if (!self::$sendHeaders) {
             return;
         }
         self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
     }
     $json = @json_encode(self::$json);
     $data = base64_encode(utf8_encode($json));
     if (strlen($data) > 240 * 1024) {
         self::$overflowed = true;
         $record = array('message' => 'Incomplete logs, chrome header size limit reached', 'context' => array(), 'level' => Logger::WARNING, 'level_name' => Logger::getLevelName(Logger::WARNING), 'channel' => 'monolog', 'datetime' => new \DateTime(), 'extra' => array());
         self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record);
         $json = @json_encode(self::$json);
         $data = base64_encode(utf8_encode($json));
     }
     if (trim($data) !== '') {
         $this->sendHeader(self::HEADER_NAME, $data);
     }
 }
 /**
  * Sends the log header
  *
  * @see sendHeader()
  */
 protected function send()
 {
     if (!self::$initialized) {
         $this->sendHeaders = $this->headersAccepted();
         self::$json['request_uri'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
         self::$initialized = true;
     }
     $this->sendHeader(self::HEADER_NAME, base64_encode(utf8_encode(json_encode(self::$json))));
 }