\Monolog\HandlerPHPConsoleHandler

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

Summary

Methods
Properties
Constants
handle()
__construct()
isHandling()
handleBatch()
close()
pushProcessor()
popProcessor()
setFormatter()
getFormatter()
setLevel()
getLevel()
setBubble()
getBubble()
__destruct()
getConnector()
getOptions()
No public properties found
No constants found
write()
processRecord()
getDefaultFormatter()
$level
$bubble
$formatter
$processors
N/A
initOptions()
initConnector()
handleDebugRecord()
handleExceptionRecord()
handleErrorRecord()
getRecordTags()
$options
$connector
N/A

Properties

$level

$level : 

Type

$bubble

$bubble : 

Type

$processors

$processors : 

Type

$options

$options : 

Type

$connector

$connector : \PhpConsole\Connector

Type

\PhpConsole\Connector

Methods

handle()

handle(array  $record) 

{@inheritdoc}

Parameters

array $record

__construct()

__construct(array  $options = array(), \PhpConsole\Connector|null  $connector = null, integer  $level = \Monolog\Logger::DEBUG, boolean  $bubble = true) 

Parameters

array $options

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

\PhpConsole\Connector|null $connector

Instance of \PhpConsole\Connector class (optional)

integer $level
boolean $bubble

Throws

\Exception

isHandling()

isHandling(array  $record) : Boolean

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

This is mostly done for performance reasons, to avoid calling processors for nothing.

Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.

Parameters

array $record

Partial log record containing only a level key

Returns

Boolean

handleBatch()

handleBatch(array  $records) 

Handles a set of records at once.

Parameters

array $records

The records to handle (an array of record arrays)

close()

close() 

Closes the handler.

This will be called automatically when the object is destroyed

pushProcessor()

pushProcessor(callable  $callback) : self

Adds a processor in the stack.

Parameters

callable $callback

Returns

self

popProcessor()

popProcessor() : callable

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

Returns

callable

setLevel()

setLevel(integer|string  $level) : self

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

Parameters

integer|string $level

Level or level name

Returns

self

getLevel()

getLevel() : integer

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

Returns

integer

setBubble()

setBubble(Boolean  $bubble) : self

Sets the bubbling behavior.

Parameters

Boolean $bubble

true means that this handler allows bubbling. false means that bubbling is not permitted.

Returns

self

getBubble()

getBubble() : Boolean

Gets the bubbling behavior.

Returns

Boolean —

true means that this handler allows bubbling. false means that bubbling is not permitted.

__destruct()

__destruct() 

getConnector()

getConnector() 

getOptions()

getOptions() 

write()

write(array  $record) : void

Writes the record down to the log of the implementing handler

Parameters

array $record

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array

getDefaultFormatter()

getDefaultFormatter() 

{@inheritDoc}

initOptions()

initOptions(array  $options) 

Parameters

array $options

initConnector()

initConnector(\PhpConsole\Connector  $connector = null) 

Parameters

\PhpConsole\Connector $connector

handleDebugRecord()

handleDebugRecord(array  $record) 

Parameters

array $record

handleExceptionRecord()

handleExceptionRecord(array  $record) 

Parameters

array $record

handleErrorRecord()

handleErrorRecord(array  $record) 

Parameters

array $record

getRecordTags()

getRecordTags(array  $record) 

Parameters

array $record