PHPConsoleHandler
extends AbstractProcessingHandler
in package
Monolog handler for Google Chrome extension "PHP Console"
Since 2.8.0 and 3.2.0, PHPConsole is abandoned and thus we will drop this handler in Monolog 4
Display PHP error/debug log messages in Google Chrome console and notification popups, executes PHP code remotely
Usage:
-
Install Google Chrome extension [now dead and removed from the chrome store]
-
See overview https://github.com/barbushin/php-console#overview
-
Install PHP Console library https://github.com/barbushin/php-console#installation
-
Example (result will looks like http://i.hizliresim.com/vg3Pz4.png)
$logger = new \Monolog\Logger('all', array(new \Monolog\Handler\PHPConsoleHandler())); \Monolog\ErrorHandler::register($logger); echo $undefinedVar; $logger->debug('SELECT * FROM users', array('db', 'time' => 0.012)); PC::debug($_SERVER); // PHP Console debugger for any type of vars
Tags
Table of Contents
Properties
- $bubble : bool
- $formatter : FormatterInterface|null
- $level : Level
- $processors : array<string|int, callable>
- $connector : Connector
- $options : array<string|int, mixed>
Methods
- __construct() : mixed
- __destruct() : mixed
- __sleep() : mixed
- close() : void
- Closes the handler.
- getBubble() : bool
- Gets the bubbling behavior.
- getConnector() : Connector
- getFormatter() : FormatterInterface
- getLevel() : Level
- Gets minimum logging level at which this handler will be triggered.
- getOptions() : array<string, mixed>
- handle() : bool
- Handles a record.
- handleBatch() : void
- Handles a set of records at once.
- isHandling() : bool
- Checks whether the given record will be handled by this handler.
- popProcessor() : callable
- pushProcessor() : HandlerInterface
- reset() : void
- setBubble() : $this
- Sets the bubbling behavior.
- setFormatter() : HandlerInterface
- setLevel() : $this
- Sets minimum logging level at which this handler will be triggered.
- getDefaultFormatter() : FormatterInterface
- processRecord() : LogRecord
- resetProcessors() : void
- write() : void
- Writes the record down to the log of the implementing handler
- getRecordTags() : array{: string, : array}
- handleDebugRecord() : void
- handleErrorRecord() : void
- handleExceptionRecord() : void
- initConnector() : Connector
- initOptions() : array<string, mixed>
Properties
$bubble
protected
bool
$bubble
= true
$formatter
protected
FormatterInterface|null
$formatter
= null
$level
protected
Level
$level
= \Monolog\Level::Debug
$processors
protected
array<string|int, callable>
$processors
= []
Tags
$connector
private
Connector
$connector
$options
private
array<string|int, mixed>
$options
= [
'enabled' => true,
// bool Is PHP Console server enabled
'classesPartialsTraceIgnore' => ['Monolog\\'],
// array Hide calls of classes started with...
'debugTagsKeysInContext' => [0, 'tag'],
// bool Is PHP Console server enabled
'useOwnErrorsHandler' => false,
// bool Enable errors handling
'useOwnExceptionsHandler' => false,
// bool Enable exceptions handling
'sourcesBasePath' => null,
// string Base path of all project sources to strip in errors source paths
'registerHelper' => true,
// bool Register PhpConsole\Helper that allows short debug calls like PC::debug($var, 'ta.g.s')
'serverEncoding' => null,
// string|null Server internal encoding
'headersLimit' => null,
// int|null Set headers size limit for your web-server
'password' => null,
// string|null Protect PHP Console connection by password
'enableSslOnlyMode' => false,
// bool Force connection by SSL for clients with PHP Console installed
'ipMasks' => [],
// array Set IP masks of clients that will be allowed to connect to PHP Console: array('192.168.*.*', '127.0.0.1')
'enableEvalListener' => false,
// bool Enable eval request to be handled by eval dispatcher(if enabled, 'password' option is also required)
'dumperDetectCallbacks' => false,
// bool Convert callback items in dumper vars to (callback SomeClass::someMethod) strings
'dumperLevelLimit' => 5,
// int Maximum dumped vars array or object nested dump level
'dumperItemsCountLimit' => 100,
// int Maximum dumped var same level array items or object properties number
'dumperItemSizeLimit' => 5000,
// int Maximum length of any string or dumped array item
'dumperDumpSizeLimit' => 500000,
// int Maximum approximate size of dumped vars result formatted in JSON
'detectDumpTraceAndSource' => false,
// bool Autodetect and append trace data to debug
'dataStorage' => null,
]
Tags
Methods
__construct()
public
__construct([array<string, mixed> $options = [] ][, Connector|null $connector = null ][, int|string|Level $level = Level::Debug ][, bool $bubble = true ]) : mixed
Parameters
- $options : array<string, mixed> = []
-
See \Monolog\Handler\PHPConsoleHandler::$options for more details
- $connector : Connector|null = null
-
Instance of \PhpConsole\Connector class (optional)
- $level : int|string|Level = Level::Debug
-
The minimum logging level at which this handler will be triggered
- $bubble : bool = true
-
Whether the messages that are handled can bubble up the stack or not
Tags
__destruct()
public
__destruct() : mixed
__sleep()
public
__sleep() : mixed
close()
Closes the handler.
public
close() : void
Tags
getBubble()
Gets the bubbling behavior.
public
getBubble() : bool
Return values
bool —true means that this handler allows bubbling. false means that bubbling is not permitted.
getConnector()
public
getConnector() : Connector
Return values
ConnectorgetFormatter()
public
getFormatter() : FormatterInterface
Tags
Return values
FormatterInterfacegetLevel()
Gets minimum logging level at which this handler will be triggered.
public
getLevel() : Level
Return values
LevelgetOptions()
public
getOptions() : array<string, mixed>
Return values
array<string, mixed>handle()
Handles a record.
public
handle(LogRecord $record) : bool
Parameters
- $record : LogRecord
-
The record to handle
Return values
bool —true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.
handleBatch()
Handles a set of records at once.
public
handleBatch(array<string|int, mixed> $records) : void
Parameters
- $records : array<string|int, mixed>
-
The records to handle
Tags
isHandling()
Checks whether the given record will be handled by this handler.
public
isHandling(LogRecord $record) : bool
Parameters
- $record : LogRecord
-
Partial log record having only a level initialized
Tags
Return values
boolpopProcessor()
public
popProcessor() : callable
Tags
Return values
callablepushProcessor()
public
pushProcessor(callable $callback) : HandlerInterface
Parameters
- $callback : callable
Tags
Return values
HandlerInterfacereset()
public
reset() : void
setBubble()
Sets the bubbling behavior.
public
setBubble(bool $bubble) : $this
Parameters
- $bubble : bool
-
true means that this handler allows bubbling. false means that bubbling is not permitted.
Return values
$thissetFormatter()
public
setFormatter(FormatterInterface $formatter) : HandlerInterface
Parameters
- $formatter : FormatterInterface
Tags
Return values
HandlerInterfacesetLevel()
Sets minimum logging level at which this handler will be triggered.
public
setLevel(Level|LogLevel::* $level) : $this
Parameters
- $level : Level|LogLevel::*
-
Level or level name
Tags
Return values
$thisgetDefaultFormatter()
protected
getDefaultFormatter() : FormatterInterface
Tags
Return values
FormatterInterfaceprocessRecord()
protected
processRecord(LogRecord $record) : LogRecord
Parameters
- $record : LogRecord
Return values
LogRecordresetProcessors()
protected
resetProcessors() : void
write()
Writes the record down to the log of the implementing handler
protected
write(LogRecord $record) : void
Parameters
- $record : LogRecord
getRecordTags()
private
getRecordTags(LogRecord $record) : array{: string, : array}
Parameters
- $record : LogRecord
Return values
array{: string, : array}handleDebugRecord()
private
handleDebugRecord(LogRecord $record) : void
Parameters
- $record : LogRecord
handleErrorRecord()
private
handleErrorRecord(LogRecord $record) : void
Parameters
- $record : LogRecord
handleExceptionRecord()
private
handleExceptionRecord(LogRecord $record) : void
Parameters
- $record : LogRecord
initConnector()
private
initConnector([Connector|null $connector = null ]) : Connector
Parameters
- $connector : Connector|null = null
Return values
ConnectorinitOptions()
private
initOptions(array<string, mixed> $options) : array<string, mixed>
Parameters
- $options : array<string, mixed>