Documentation

NewRelicHandler extends AbstractProcessingHandler
in package

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']

Tags
see
https://docs.newrelic.com/docs/agents/php-agent
see
https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security

Table of Contents

Properties

$appName  : string
Name of the New Relic application that will receive logs from this handler.
$bubble  : mixed
$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?
$formatter  : FormatterInterface
$level  : mixed
$processors  : mixed
$transactionName  : string
Name of the current transaction

Methods

__construct()  : mixed
__destruct()  : mixed
close()  : mixed
Closes the handler.
getBubble()  : bool
Gets the bubbling behavior.
getFormatter()  : FormatterInterface
Gets the formatter.
getLevel()  : int
Gets minimum logging level at which this handler will be triggered.
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.
getAppName()  : null|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.
getDefaultFormatter()  : FormatterInterface
Gets the default formatter.
getTransactionName()  : null|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
isNewRelicEnabled()  : bool
Checks whether the NewRelic extension is enabled in the system.
processRecord()  : array<string|int, mixed>
Processes a record.
setNewRelicAppName()  : mixed
Sets the NewRelic application that should receive this log.
setNewRelicParameter()  : mixed
setNewRelicTransactionName()  : mixed
Overwrites the name of the current transaction
write()  : void
Writes the record down to the log of the implementing handler

Properties

$appName

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

protected string $appName

$explodeArrays

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?

protected bool $explodeArrays

$transactionName

Name of the current transaction

protected string $transactionName

Methods

__construct()

public __construct([mixed $level = Logger::ERROR ][, mixed $bubble = true ][, string $appName = null ][, bool $explodeArrays = false ][, string $transactionName = null ]) : mixed
Parameters
$level : mixed = Logger::ERROR

The minimum logging level at which this handler will be triggered

$bubble : mixed = true

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

$appName : string = null
$explodeArrays : bool = false
$transactionName : string = null

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

getAppName()

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.

protected getAppName(array<string|int, mixed> $context) : null|string
Parameters
$context : array<string|int, mixed>
Return values
null|string

getTransactionName()

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

protected getTransactionName(array<string|int, mixed> $context) : null|string
Parameters
$context : array<string|int, mixed>
Return values
null|string

isNewRelicEnabled()

Checks whether the NewRelic extension is enabled in the system.

protected isNewRelicEnabled() : bool
Return values
bool

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>

setNewRelicAppName()

Sets the NewRelic application that should receive this log.

protected setNewRelicAppName(string $appName) : mixed
Parameters
$appName : string

setNewRelicParameter()

protected setNewRelicParameter(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed

setNewRelicTransactionName()

Overwrites the name of the current transaction

protected setNewRelicTransactionName(string $transactionName) : mixed
Parameters
$transactionName : string

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>

        
On this page

Search results