PHPConsoleHandler
extends AbstractProcessingHandler
in package
Monolog handler for Google Chrome extension "PHP Console"
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
- $bubble : bool
- $formatter : FormatterInterface|null
- $level : int
- $processors : array<string|int, callable>
- $connector : Connector
- $options : array<string, mixed>
- __construct() : mixed
- __destruct() : mixed
- __sleep() : mixed
- close() : void
- Closes the handler.
- getBubble() : bool
- Gets the bubbling behavior.
- getConnector() : Connector
- getFormatter() : FormatterInterface
- {@inheritDoc}
- getLevel() : int
- Gets minimum logging level at which this handler will be triggered.
- getOptions() : array<string, mixed>
- handle() : bool
- {@inheritDoc}
- handleBatch() : void
- Handles a set of records at once.
- isHandling() : bool
- {@inheritDoc}
- popProcessor() : callable
- {@inheritDoc}
- pushProcessor() : HandlerInterface
- {@inheritDoc}
- reset() : void
- setBubble() : self
- Sets the bubbling behavior.
- setFormatter() : HandlerInterface
- {@inheritDoc}
- setLevel() : self
- Sets minimum logging level at which this handler will be triggered.
- getDefaultFormatter() : FormatterInterface
- {@inheritDoc}
- processRecord() : array<string|int, mixed>
- Processes a record.
- resetProcessors() : void
- write() : void
- Writes the record down to the log of the implementing handler
- getRecordTags() : string
- handleDebugRecord() : void
- handleErrorRecord() : void
- handleExceptionRecord() : void
- initConnector() : Connector
- initOptions() : array<string, mixed>
Properties
$bubble
protected
bool
$bubble
= true
$formatter
protected
FormatterInterface|null
$formatter
$level
protected
int
$level
= MonologLogger::DEBUG
Tags
$processors
protected
array<string|int, callable>
$processors
= []
Tags
$connector
private
Connector
$connector
$options
private
array<string, 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 PhpConsoleHelper 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,
]
Methods
__construct()
public
__construct([array<string, mixed> $options = [] ][, Connector|null $connector = null ][, mixed $level = Logger::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 : mixed = Logger::DEBUG
- $bubble : bool = true
Tags
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —__sleep()
public
__sleep() : mixed
Return values
mixed —close()
Closes the handler.
public
close() : void
Return values
void —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
Connector —getFormatter()
{@inheritDoc}
public
getFormatter() : FormatterInterface
Return values
FormatterInterface —getLevel()
Gets minimum logging level at which this handler will be triggered.
public
getLevel() : int
Tags
Return values
int —getOptions()
public
getOptions() : array<string, mixed>
Return values
array<string, mixed> —handle()
{@inheritDoc}
public
handle(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
Return values
bool —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 (an array of record arrays)
Return values
void —isHandling()
{@inheritDoc}
public
isHandling(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
Return values
bool —popProcessor()
{@inheritDoc}
public
popProcessor() : callable
Return values
callable —pushProcessor()
{@inheritDoc}
public
pushProcessor(callable $callback) : HandlerInterface
Parameters
- $callback : callable
Return values
HandlerInterface —reset()
public
reset() : void
Return values
void —setBubble()
Sets the bubbling behavior.
public
setBubble(bool $bubble) : self
Parameters
- $bubble : bool
-
true means that this handler allows bubbling. false means that bubbling is not permitted.
Return values
self —setFormatter()
{@inheritDoc}
public
setFormatter(FormatterInterface $formatter) : HandlerInterface
Parameters
- $formatter : FormatterInterface
Return values
HandlerInterface —setLevel()
Sets minimum logging level at which this handler will be triggered.
public
setLevel(Level|LevelName|\Psr\Log\LogLevel::* $level) : self
Parameters
- $level : Level|LevelName|\Psr\Log\LogLevel::*
-
Level or level name
Return values
self —getDefaultFormatter()
{@inheritDoc}
protected
getDefaultFormatter() : FormatterInterface
Return values
FormatterInterface —processRecord()
Processes a record.
protected
processRecord(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —resetProcessors()
protected
resetProcessors() : void
Return values
void —write()
Writes the record down to the log of the implementing handler
protected
write(array<string|int, mixed> $record) : void
Parameters
- $record : array<string|int, mixed>
Return values
void —getRecordTags()
private
getRecordTags(array<string|int, mixed> &$record) : string
Parameters
- $record : array<string|int, mixed>
Tags
Return values
string —handleDebugRecord()
private
handleDebugRecord(array<string|int, mixed> $record) : void
Parameters
- $record : array<string|int, mixed>
Tags
Return values
void —handleErrorRecord()
private
handleErrorRecord(array<string|int, mixed> $record) : void
Parameters
- $record : array<string|int, mixed>
Tags
Return values
void —handleExceptionRecord()
private
handleExceptionRecord(array<string|int, mixed> $record) : void
Parameters
- $record : array<string|int, mixed>
Tags
Return values
void —initConnector()
private
initConnector([Connector|null $connector = null ]) : Connector
Parameters
- $connector : Connector|null = null
Return values
Connector —initOptions()
private
initOptions(array<string, mixed> $options) : array<string, mixed>
Parameters
- $options : array<string, mixed>