\Monolog\HandlerChromePHPHandler

Handler sending logs to the ChromePHP extension (http://www.chromephp.com/)

This also works out of the box with Firefox 43+

Summary

Methods
Properties
Constants
handle()
__construct()
isHandling()
handleBatch()
close()
pushProcessor()
popProcessor()
setFormatter()
getFormatter()
setLevel()
getLevel()
setBubble()
getBubble()
__destruct()
__get()
__set()
No public properties found
VERSION
HEADER_NAME
USER_AGENT_REGEX
write()
processRecord()
getDefaultFormatter()
send()
sendHeader()
headersAccepted()
$level
$bubble
$formatter
$processors
$initialized
$overflowed
$json
$sendHeaders
N/A
No private methods found
No private properties found
N/A

Constants

VERSION

VERSION = '4.0'

Version of the extension

HEADER_NAME

HEADER_NAME = 'X-ChromeLogger-Data'

Header name

USER_AGENT_REGEX

USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}'

Regular expression to detect supported browsers (matches any Chrome, or Firefox 43+)

Properties

$level

$level : 

Type

$bubble

$bubble : 

Type

$processors

$processors : 

Type

$initialized

$initialized : 

Type

$overflowed

$overflowed : Boolean

Tracks whether we sent too much data

Chrome limits the headers to 256KB, so when we sent 240KB we stop sending

Type

Boolean

$json

$json : 

Type

$sendHeaders

$sendHeaders : 

Type

Methods

handle()

handle(array  $record) 

{@inheritdoc}

Parameters

array $record

__construct()

__construct(integer  $level = \Monolog\Logger::DEBUG, Boolean  $bubble = true) 

Parameters

integer $level

The minimum logging level at which this handler will be triggered

Boolean $bubble

Whether the messages that are handled can bubble up the stack or not

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) 

{@inheritdoc}

Parameters

array $records

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() 

__get()

__get(  $property) 

BC getter for the sendHeaders property that has been made static

Parameters

$property

__set()

__set(  $property,   $value) 

BC setter for the sendHeaders property that has been made static

Parameters

$property
$value

write()

write(array  $record) : void

Creates & sends header for a record

Parameters

array $record

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array

getDefaultFormatter()

getDefaultFormatter() 

{@inheritDoc}

send()

send() 

Sends the log header

sendHeader()

sendHeader(string  $header, string  $content) 

Send header string to the client

Parameters

string $header
string $content

headersAccepted()

headersAccepted() : Boolean

Verifies if the headers are accepted by the current user agent

Returns

Boolean