46 'version' => self::VERSION,
47 'columns' => array(
'label',
'log',
'backtrace',
'type'),
60 if (!function_exists(
'json_encode')) {
61 throw new \RuntimeException(
'PHP\'s json extension is required to use Monolog\'s ChromePHPHandler');
72 foreach ($records as $record) {
73 if ($record[
'level'] < $this->level) {
81 self::$json[
'rows'] = array_merge(self::$json[
'rows'],
$messages);
101 protected function write(array $record)
103 self::$json[
'rows'][] = $record[
'formatted'];
115 if (self::$overflowed || !self::$sendHeaders) {
119 if (!self::$initialized) {
120 self::$initialized =
true;
123 if (!self::$sendHeaders) {
127 self::$json[
'request_uri'] = isset(
$_SERVER[
'REQUEST_URI']) ?
$_SERVER[
'REQUEST_URI'] :
'';
130 $json = @json_encode(self::$json);
132 if (strlen(
$data) > 240*1024) {
133 self::$overflowed =
true;
136 'message' =>
'Incomplete logs, chrome header size limit reached',
137 'context' => array(),
140 'channel' =>
'monolog',
141 'datetime' =>
new \DateTime(),
144 self::$json[
'rows'][count(self::$json[
'rows']) - 1] = $this->
getFormatter()->format($record);
145 $json = @json_encode(self::$json);
149 if (trim(
$data) !==
'') {
162 if (!headers_sent() && self::$sendHeaders) {
163 header(sprintf(
'%s: %s',
$header, $content));
174 if (empty(
$_SERVER[
'HTTP_USER_AGENT'])) {
178 return preg_match(
'{\bChrome/\d+[\.\d+]*\b}',
$_SERVER[
'HTTP_USER_AGENT']);
186 if (
'sendHeaders' !== $property) {
187 throw new \InvalidArgumentException(
'Undefined property '.$property);
190 return static::$sendHeaders;
196 public function __set($property, $value)
198 if (
'sendHeaders' !== $property) {
199 throw new \InvalidArgumentException(
'Undefined property '.$property);
202 static::$sendHeaders = $value;
const DEBUG
Detailed debug information.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
handleBatch(array $records)
{Handles a set of records at once.The records to handle (an array of record arrays)} ...
sendHeader($header, $content)
Send header string to the client.
__get($property)
BC getter for the sendHeaders property that has been made static.
Base Handler class providing the Handler structure.
const HEADER_NAME
Header name.
Handler sending logs to the ChromePHP extension (http://www.chromephp.com/)
getFormatter()
{Gets the formatter.FormatterInterface}
const WARNING
Exceptional occurrences that are not errors.
__construct($level=Logger::DEBUG, $bubble=true)
processRecord(array $record)
Processes a record.
headersAccepted()
Verifies if the headers are accepted by the current user agent.
send()
Sends the log header.
static getLevelName($level)
Gets the name of the logging level.
__set($property, $value)
BC setter for the sendHeaders property that has been made static.
write(array $record)
Creates & sends header for a record.
const VERSION
Version of the extension.