44 'classesPartialsTraceIgnore' => array(
'Monolog\\'),
45 'debugTagsKeysInContext' => array(0,
'tag'),
46 'useOwnErrorsHandler' =>
false,
47 'useOwnExceptionsHandler' =>
false,
48 'sourcesBasePath' => null,
49 'registerHelper' =>
true,
50 'serverEncoding' => null,
51 'headersLimit' => null,
53 'enableSslOnlyMode' =>
false,
55 'enableEvalListener' =>
false,
56 'dumperDetectCallbacks' =>
false,
57 'dumperLevelLimit' => 5,
58 'dumperItemsCountLimit' => 100,
59 'dumperItemSizeLimit' => 5000,
60 'dumperDumpSizeLimit' => 500000,
61 'detectDumpTraceAndSource' =>
false,
62 'dataStorage' => null,
77 if (!class_exists(
'PhpConsole\Connector')) {
78 throw new Exception(
'PHP Console library not found. See https://github.com/barbushin/php-console#installation');
87 $wrongOptions = array_diff(array_keys($options), array_keys($this->options));
89 throw new Exception(
'Unknown options: ' . implode(
', ', $wrongOptions));
92 return array_replace($this->options, $options);
98 if ($this->options[
'dataStorage']) {
99 Connector::setPostponeStorage($this->options[
'dataStorage']);
104 if ($this->options[
'registerHelper'] && !Helper::isRegistered()) {
108 if ($this->options[
'enabled'] &&
$connector->isActiveClient()) {
109 if ($this->options[
'useOwnErrorsHandler'] || $this->options[
'useOwnExceptionsHandler']) {
111 $handler->setHandleErrors($this->options[
'useOwnErrorsHandler']);
112 $handler->setHandleExceptions($this->options[
'useOwnExceptionsHandler']);
115 if ($this->options[
'sourcesBasePath']) {
116 $connector->setSourcesBasePath($this->options[
'sourcesBasePath']);
118 if ($this->options[
'serverEncoding']) {
119 $connector->setServerEncoding($this->options[
'serverEncoding']);
121 if ($this->options[
'password']) {
122 $connector->setPassword($this->options[
'password']);
124 if ($this->options[
'enableSslOnlyMode']) {
127 if ($this->options[
'ipMasks']) {
128 $connector->setAllowedIpMasks($this->options[
'ipMasks']);
130 if ($this->options[
'headersLimit']) {
131 $connector->setHeadersLimit($this->options[
'headersLimit']);
133 if ($this->options[
'detectDumpTraceAndSource']) {
134 $connector->getDebugDispatcher()->detectTraceAndSource =
true;
137 $dumper->levelLimit = $this->options[
'dumperLevelLimit'];
138 $dumper->itemsCountLimit = $this->options[
'dumperItemsCountLimit'];
139 $dumper->itemSizeLimit = $this->options[
'dumperItemSizeLimit'];
140 $dumper->dumpSizeLimit = $this->options[
'dumperDumpSizeLimit'];
141 $dumper->detectCallbacks = $this->options[
'dumperDetectCallbacks'];
142 if ($this->options[
'enableEvalListener']) {
162 if ($this->options[
'enabled'] && $this->connector->isActiveClient()) {
163 return parent::handle($record);
175 protected function write(array $record)
179 } elseif (isset($record[
'context'][
'exception']) && $record[
'context'][
'exception'] instanceof
Exception) {
190 if ($record[
'context']) {
191 $message .=
' ' . json_encode($this->connector->getDumper()->dump(array_filter($record[
'context'])));
193 $this->connector->getDebugDispatcher()->dispatchDebug(
$message,
$tags, $this->options[
'classesPartialsTraceIgnore']);
198 $this->connector->getErrorsDispatcher()->dispatchException($record[
'context'][
'exception']);
205 $this->connector->getErrorsDispatcher()->dispatchError(
210 $this->options[
'classesPartialsTraceIgnore']
217 if (!empty($record[
'context'])) {
219 foreach ($this->options[
'debugTagsKeysInContext'] as
$key) {
232 return $tags ?: strtolower($record[
'level_name']);
getRecordTags(array &$record)
const NOTICE
Uncommon events.
const DEBUG
Detailed debug information.
Monolog handler for Google Chrome extension "PHP Console".
handleDebugRecord(array $record)
Base Handler class providing the Handler structure.
initConnector(Connector $connector=null)
catch(Exception $e) $message
handle(array $record)
Handles a record.
handleExceptionRecord(array $record)
__construct(array $options=array(), Connector $connector=null, $level=Logger::DEBUG, $bubble=true)
write(array $record)
Writes the record down to the log of the implementing handler.
handleErrorRecord(array $record)
initOptions(array $options)