Documentation

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:

  1. Install Google Chrome extension https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef

  2. See overview https://github.com/barbushin/php-console#overview

  3. Install PHP Console library https://github.com/barbushin/php-console#installation

  4. 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->addDebug('SELECT * FROM users', array('db', 'time' => 0.012)); PC::debug($_SERVER); // PHP Console debugger for any type of vars

Tags
author

Sergey Barbushin https://www.linkedin.com/in/barbushin

Table of Contents

Properties

$bubble  : mixed
$formatter  : FormatterInterface
$level  : mixed
$processors  : mixed
$connector  : Connector
$options  : mixed

Methods

__construct()  : mixed
__destruct()  : mixed
close()  : mixed
Closes the handler.
getBubble()  : bool
Gets the bubbling behavior.
getConnector()  : mixed
getFormatter()  : FormatterInterface
Gets the formatter.
getLevel()  : int
Gets minimum logging level at which this handler will be triggered.
getOptions()  : mixed
handle()  : bool
Handles a record.
handleBatch()  : mixed
Handles a set of records at once.
isHandling()  : bool
Checks whether the given record will be handled by this handler.
popProcessor()  : callable
Removes the processor on top of the stack and returns it.
pushProcessor()  : self
Adds a processor in the stack.
reset()  : mixed
setBubble()  : self
Sets the bubbling behavior.
setFormatter()  : self
Sets the formatter.
setLevel()  : self
Sets minimum logging level at which this handler will be triggered.
getDefaultFormatter()  : FormatterInterface
Gets the default formatter.
processRecord()  : array<string|int, mixed>
Processes a record.
write()  : void
Writes the record down to the log of the implementing handler
getRecordTags()  : mixed
handleDebugRecord()  : mixed
handleErrorRecord()  : mixed
handleExceptionRecord()  : mixed
initConnector()  : mixed
initOptions()  : mixed

Properties

$options

private mixed $options = array( 'enabled' => true, // bool Is PHP Console server enabled 'classesPartialsTraceIgnore' => array('Monolog\\'), // array Hide calls of classes started with... 'debugTagsKeysInContext' => array(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(), // 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|int, mixed> $options = array() ][, Connector|null $connector = null ][, int $level = Logger::DEBUG ][, bool $bubble = true ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

See \Monolog\Handler\PHPConsoleHandler::$options for more details

$connector : Connector|null = null

Instance of \PhpConsole\Connector class (optional)

$level : int = Logger::DEBUG
$bubble : bool = true
Tags
throws
Exception

close()

Closes the handler.

public close() : mixed

This will be called automatically when the object is destroyed

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.

getLevel()

Gets minimum logging level at which this handler will be triggered.

public getLevel() : int
Return values
int

handle()

Handles a record.

public handle(array<string|int, mixed> $record) : bool
Parameters
$record : array<string|int, mixed>

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) : mixed
Parameters
$records : array<string|int, mixed>

The records to handle (an array of record arrays)

isHandling()

Checks whether the given record will be handled by this handler.

public isHandling(array<string|int, mixed> $record) : bool
Parameters
$record : array<string|int, mixed>

Partial log record containing only a level key

Return values
bool

popProcessor()

Removes the processor on top of the stack and returns it.

public popProcessor() : callable
Return values
callable

pushProcessor()

Adds a processor in the stack.

public pushProcessor(mixed $callback) : self
Parameters
$callback : mixed
Return values
self

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

setLevel()

Sets minimum logging level at which this handler will be triggered.

public setLevel(int|string $level) : self
Parameters
$level : int|string

Level or level name

Return values
self

processRecord()

Processes a record.

protected processRecord(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
$record : array<string|int, mixed>
Return values
array<string|int, mixed>

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>

getRecordTags()

private getRecordTags(array<string|int, mixed> &$record) : mixed
Parameters
$record : array<string|int, mixed>

handleDebugRecord()

private handleDebugRecord(array<string|int, mixed> $record) : mixed
Parameters
$record : array<string|int, mixed>

handleErrorRecord()

private handleErrorRecord(array<string|int, mixed> $record) : mixed
Parameters
$record : array<string|int, mixed>

handleExceptionRecord()

private handleExceptionRecord(array<string|int, mixed> $record) : mixed
Parameters
$record : array<string|int, mixed>

initConnector()

private initConnector([Connector $connector = null ]) : mixed
Parameters
$connector : Connector = null

initOptions()

private initOptions(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>

        
On this page

Search results