39 const USER_AGENT_REGEX =
'{\b(?:Chrome/\d+(?:\.\d+)*|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}';
53 'version' => self::VERSION,
54 'columns' =>
array(
'label',
'log',
'backtrace',
'type'),
67 if (!function_exists(
'json_encode')) {
68 throw new \RuntimeException(
'PHP\'s json extension is required to use Monolog\'s ChromePHPHandler');
79 foreach ($records as $record) {
80 if ($record[
'level'] < $this->level) {
88 self::$json[
'rows'] = array_merge(self::$json[
'rows'],
$messages);
110 self::$json[
'rows'][] = $record[
'formatted'];
122 if (self::$overflowed || !self::$sendHeaders) {
126 if (!self::$initialized) {
127 self::$initialized =
true;
130 if (!self::$sendHeaders) {
134 self::$json[
'request_uri'] = isset(
$_SERVER[
'REQUEST_URI']) ?
$_SERVER[
'REQUEST_URI'] :
'';
137 $json = @json_encode(self::$json);
139 if (strlen(
$data) > 240 * 1024) {
140 self::$overflowed =
true;
143 'message' =>
'Incomplete logs, chrome header size limit reached',
144 'context' =>
array(),
147 'channel' =>
'monolog',
151 self::$json[
'rows'][count(self::$json[
'rows']) - 1] = $this->
getFormatter()->format($record);
152 $json = @json_encode(self::$json);
156 if (trim(
$data) !==
'') {
169 if (!headers_sent() && self::$sendHeaders) {
181 if (empty(
$_SERVER[
'HTTP_USER_AGENT'])) {
185 return preg_match(self::USER_AGENT_REGEX,
$_SERVER[
'HTTP_USER_AGENT']);
193 if (
'sendHeaders' !== $property) {
194 throw new \InvalidArgumentException(
'Undefined property '.$property);
197 return static::$sendHeaders;
203 public function __set($property, $value)
205 if (
'sendHeaders' !== $property) {
206 throw new \InvalidArgumentException(
'Undefined property '.$property);
209 static::$sendHeaders = $value;
const USER_AGENT_REGEX
Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+) ...
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}
Add a drawing to the header
const WARNING
Exceptional occurrences that are not errors.
__construct($level=Logger::DEBUG, $bubble=true)
Create styles array
The data for the language used.
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.