\Monolog\HandlerNewRelicHandler

Class to record a log on a NewRelic application.

Enabling New Relic High Security mode may prevent capture of useful information.

This handler requires a NormalizerFormatter to function and expects an array in $record['formatted']

Summary

Methods
Properties
Constants
handle()
reset()
pushProcessor()
popProcessor()
setFormatter()
getFormatter()
__construct()
isHandling()
setLevel()
getLevel()
setBubble()
getBubble()
handleBatch()
close()
__destruct()
__sleep()
No public properties found
No constants found
write()
processRecord()
resetProcessors()
getDefaultFormatter()
isNewRelicEnabled()
getAppName()
getTransactionName()
setNewRelicAppName()
setNewRelicTransactionName()
setNewRelicParameter()
$processors
$formatter
$level
$bubble
$appName
$transactionName
$explodeArrays
N/A
No private methods found
No private properties found
N/A

Properties

$processors

$processors : callable[]

Type

callable[]

$formatter

$formatter : ?\Monolog\Formatter\FormatterInterface

Type

FormatterInterface

$level

$level : int

Type

int

$bubble

$bubble : bool

Type

bool

$appName

$appName : ?string

Name of the New Relic application that will receive logs from this handler.

Type

?string

$transactionName

$transactionName : ?string

Name of the current transaction

Type

?string

$explodeArrays

$explodeArrays : bool

Some context and extra data is passed into the handler as arrays of values. Do we send them as is (useful if we are using the API), or explode them for display on the NewRelic RPM website?

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::ERROR, bool  $bubble = true, string|null  $appName = null, bool  $explodeArrays = false, string|null  $transactionName = null) : mixed

{@inheritDoc}

Parameters

mixed $level
bool $bubble
string|null $appName
bool $explodeArrays
string|null $transactionName

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

Handles a set of records at once.

Parameters

array $records

The records to handle (an array of record arrays)

close()

close() : void

Closes the handler.

__destruct()

__destruct() : mixed

Returns

mixed —

__sleep()

__sleep() : mixed

Returns

mixed —

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 —

resetProcessors()

resetProcessors() : void

getDefaultFormatter()

getDefaultFormatter() : \Monolog\Formatter\FormatterInterface

{@inheritDoc}

Returns

\Monolog\Formatter\FormatterInterface —

isNewRelicEnabled()

isNewRelicEnabled() : bool

Checks whether the NewRelic extension is enabled in the system.

Returns

bool —

getAppName()

getAppName(array  $context) : ?string

Returns the appname where this log should be sent. Each log can override the default appname, set in this handler's constructor, by providing the appname in it's context.

Parameters

array $context

Returns

?string —

getTransactionName()

getTransactionName(array  $context) : ?string

Returns the name of the current transaction. Each log can override the default transaction name, set in this handler's constructor, by providing the transaction_name in it's context

Parameters

array $context

Returns

?string —

setNewRelicAppName()

setNewRelicAppName(string  $appName) : void

Sets the NewRelic application that should receive this log.

Parameters

string $appName

setNewRelicTransactionName()

setNewRelicTransactionName(string  $transactionName) : void

Overwrites the name of the current transaction

Parameters

string $transactionName

setNewRelicParameter()

setNewRelicParameter(string  $key, mixed  $value) : void

Parameters

string $key
mixed $value