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
Table of Contents
- $appName : string|null
- Name of the New Relic application that will receive logs from this handler.
- $bubble : bool
- $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|null
- $level : int
- $processors : array<string|int, callable>
- $transactionName : string|null
- Name of the current transaction
- __construct() : mixed
- {@inheritDoc}
- __destruct() : mixed
- __sleep() : mixed
- close() : void
- Closes the handler.
- getBubble() : bool
- Gets the bubbling behavior.
- getFormatter() : FormatterInterface
- {@inheritDoc}
- getLevel() : int
- Gets minimum logging level at which this handler will be triggered.
- handle() : bool
- {@inheritDoc}
- handleBatch() : void
- Handles a set of records at once.
- isHandling() : bool
- {@inheritDoc}
- popProcessor() : callable
- {@inheritDoc}
- pushProcessor() : HandlerInterface
- {@inheritDoc}
- reset() : void
- setBubble() : self
- Sets the bubbling behavior.
- setFormatter() : HandlerInterface
- {@inheritDoc}
- setLevel() : self
- Sets minimum logging level at which this handler will be triggered.
- getAppName() : string|null
- 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
- {@inheritDoc}
- getTransactionName() : string|null
- 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.
- resetProcessors() : void
- setNewRelicAppName() : void
- Sets the NewRelic application that should receive this log.
- setNewRelicParameter() : void
- setNewRelicTransactionName() : void
- 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|null
$appName
$bubble
protected
bool
$bubble
= true
$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
$formatter
protected
FormatterInterface|null
$formatter
$level
protected
int
$level
= MonologLogger::DEBUG
Tags
$processors
protected
array<string|int, callable>
$processors
= []
Tags
$transactionName
Name of the current transaction
protected
string|null
$transactionName
Methods
__construct()
{@inheritDoc}
public
__construct([mixed $level = Logger::ERROR ][, bool $bubble = true ][, string|null $appName = null ][, bool $explodeArrays = false ][, string|null $transactionName = null ]) : mixed
Parameters
- $level : mixed = Logger::ERROR
- $bubble : bool = true
- $appName : string|null = null
- $explodeArrays : bool = false
- $transactionName : string|null = null
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —__sleep()
public
__sleep() : mixed
Return values
mixed —close()
Closes the handler.
public
close() : void
Return values
void —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.
getFormatter()
{@inheritDoc}
public
getFormatter() : FormatterInterface
Return values
FormatterInterface —getLevel()
Gets minimum logging level at which this handler will be triggered.
public
getLevel() : int
Tags
Return values
int —handle()
{@inheritDoc}
public
handle(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
Return values
bool —handleBatch()
Handles a set of records at once.
public
handleBatch(array<string|int, mixed> $records) : void
Parameters
- $records : array<string|int, mixed>
-
The records to handle (an array of record arrays)
Return values
void —isHandling()
{@inheritDoc}
public
isHandling(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
Return values
bool —popProcessor()
{@inheritDoc}
public
popProcessor() : callable
Return values
callable —pushProcessor()
{@inheritDoc}
public
pushProcessor(callable $callback) : HandlerInterface
Parameters
- $callback : callable
Return values
HandlerInterface —reset()
public
reset() : void
Return values
void —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 —setFormatter()
{@inheritDoc}
public
setFormatter(FormatterInterface $formatter) : HandlerInterface
Parameters
- $formatter : FormatterInterface
Return values
HandlerInterface —setLevel()
Sets minimum logging level at which this handler will be triggered.
public
setLevel(Level|LevelName|\Psr\Log\LogLevel::* $level) : self
Parameters
- $level : Level|LevelName|\Psr\Log\LogLevel::*
-
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) : string|null
Parameters
- $context : array<string|int, mixed>
Return values
string|null —getDefaultFormatter()
{@inheritDoc}
protected
getDefaultFormatter() : FormatterInterface
Return values
FormatterInterface —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) : string|null
Parameters
- $context : array<string|int, mixed>
Return values
string|null —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>
Tags
Return values
array<string|int, mixed> —resetProcessors()
protected
resetProcessors() : void
Return values
void —setNewRelicAppName()
Sets the NewRelic application that should receive this log.
protected
setNewRelicAppName(string $appName) : void
Parameters
- $appName : string
Return values
void —setNewRelicParameter()
protected
setNewRelicParameter(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
Return values
void —setNewRelicTransactionName()
Overwrites the name of the current transaction
protected
setNewRelicTransactionName(string $transactionName) : void
Parameters
- $transactionName : string
Return values
void —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>