\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()
reset()
pushProcessor()
popProcessor()
setFormatter()
getFormatter()
__construct()
isHandling()
setLevel()
getLevel()
setBubble()
getBubble()
handleBatch()
close()
__destruct()
__sleep()
No public properties found
VERSION
HEADER_NAME
USER_AGENT_REGEX
isWebRequest()
write()
processRecord()
resetProcessors()
getDefaultFormatter()
send()
sendHeader()
headersAccepted()
$processors
$formatter
$level
$bubble
$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

$processors

$processors : callable[]

Type

callable[]

$formatter

$formatter : ?\Monolog\Formatter\FormatterInterface

Type

FormatterInterface

$level

$level : int

Type

int

$bubble

$bubble : bool

Type

bool

$initialized

$initialized : bool

Type

bool

$overflowed

$overflowed : bool

Tracks whether we sent too much data

Chrome limits the headers to 4KB, so when we sent 3KB we stop sending

Type

bool

$json

$json : array

Type

array

$sendHeaders

$sendHeaders : bool

Type

bool

Methods

handle()

handle(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

reset()

reset() : void

pushProcessor()

pushProcessor(callable  $callback) : \Monolog\Handler\HandlerInterface

{@inheritDoc}

Parameters

callable $callback

Returns

\Monolog\Handler\HandlerInterface —

popProcessor()

popProcessor() : callable

{@inheritDoc}

Returns

callable —

setFormatter()

setFormatter(\Monolog\Formatter\FormatterInterface  $formatter) : \Monolog\Handler\HandlerInterface

{@inheritDoc}

Parameters

\Monolog\Formatter\FormatterInterface $formatter

Returns

\Monolog\Handler\HandlerInterface —

getFormatter()

getFormatter() : \Monolog\Formatter\FormatterInterface

{@inheritDoc}

Returns

\Monolog\Formatter\FormatterInterface —

__construct()

__construct(mixed  $level = Logger::DEBUG, bool  $bubble = true) : mixed

Parameters

mixed $level
bool $bubble

Returns

mixed —

isHandling()

isHandling(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

setLevel()

setLevel(mixed  $level) : self

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

Parameters

mixed $level

Returns

self —

getLevel()

getLevel() : int

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

Returns

int —

setBubble()

setBubble(bool  $bubble) : self

Sets the bubbling behavior.

Parameters

bool $bubble

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

Returns

self —

getBubble()

getBubble() : bool

Gets the bubbling behavior.

Returns

bool —

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

handleBatch()

handleBatch(array  $records) : void

{@inheritDoc}

Parameters

array $records

close()

close() : void

Closes the handler.

__destruct()

__destruct() : mixed

Returns

mixed —

__sleep()

__sleep() : mixed

Returns

mixed —

isWebRequest()

isWebRequest() : bool

Checks if PHP's serving a web request

Returns

bool —

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 —

resetProcessors()

resetProcessors() : void

getDefaultFormatter()

getDefaultFormatter() : \Monolog\Formatter\FormatterInterface

{@inheritDoc}

Returns

\Monolog\Formatter\FormatterInterface —

send()

send() : void

Sends the log header

sendHeader()

sendHeader(string  $header, string  $content) : void

Send header string to the client

Parameters

string $header
string $content

headersAccepted()

headersAccepted() : bool

Verifies if the headers are accepted by the current user agent

Returns

bool —