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

  • see https://docs.newrelic.com/docs/agents/php-agent
  • see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security
CloneableInstantiable
ExtendsMonolog\Handler\Handler
Monolog\Handler\AbstractHandler
Monolog\Handler\AbstractProcessingHandler
ImplementsMonolog\Handler\FormattableHandlerInterface
Monolog\Handler\HandlerInterface
Monolog\Handler\ProcessableHandlerInterface
Monolog\ResettableInterface
Methods
public __construct( $level = 400, bool $bubble = true, ?string $appName = NULL, bool $explodeArrays = false, ?string $transactionName = NULL)
 

{@inheritDoc}

    public Monolog\Handler\Handler::__destruct()
    public Monolog\Handler\Handler::__sleep()
    public Monolog\Handler\Handler::close() : void
     

    {@inheritdoc}

    public Monolog\Handler\AbstractHandler::getBubble() : bool
     

    Gets the bubbling behavior.

    • return bool true means that this handler allows bubbling. false means that bubbling is not permitted.
    public Monolog\Handler\AbstractProcessingHandler::getFormatter() : Monolog\Formatter\FormatterInterface
     

    {@inheritdoc}

    public Monolog\Handler\AbstractHandler::getLevel() : int
     

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

    • return int
    public Monolog\Handler\AbstractProcessingHandler::handle(array $record) : bool
     

    {@inheritdoc}

    public Monolog\Handler\Handler::handleBatch(array $records) : void
     

    {@inheritdoc}

    public Monolog\Handler\AbstractHandler::isHandling(array $record) : bool
     

    {@inheritdoc}

    public Monolog\Handler\AbstractProcessingHandler::popProcessor() : callable
     

    {@inheritdoc}

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

    {@inheritdoc}

    • suppress PhanTypeMismatchReturn
    public Monolog\Handler\AbstractProcessingHandler::reset()
    public Monolog\Handler\AbstractHandler::setBubble(bool $bubble) : self
     

    Sets the bubbling behavior.

    • return self
    public Monolog\Handler\AbstractProcessingHandler::setFormatter(Monolog\Formatter\FormatterInterface $formatter) : Monolog\Handler\HandlerInterface
     

    {@inheritdoc}

    • suppress PhanTypeMismatchReturn
    public Monolog\Handler\AbstractHandler::setLevel( $level) : self
     

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

    • return self
    Properties
    protected $appName
     

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

    • var string|null
    protected Monolog\Handler\AbstractHandler::$bubble
    protected $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?

    • var bool
    protected Monolog\Handler\AbstractProcessingHandler::$formatter
     
    • var FormatterInterface
    protected Monolog\Handler\AbstractHandler::$level
    protected Monolog\Handler\AbstractProcessingHandler::$processors
     
    • var callable[]
    protected $transactionName
     

    Name of the current transaction

    • var string|null
    Methods
    protected 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.

    protected getDefaultFormatter() : Monolog\Formatter\FormatterInterface
     

    {@inheritDoc}

    protected 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

    protected isNewRelicEnabled() : bool
     

    Checks whether the NewRelic extension is enabled in the system.

    • return bool
    protected Monolog\Handler\AbstractProcessingHandler::processRecord(array $record) : array
     

    Processes a record.

    protected Monolog\Handler\AbstractProcessingHandler::resetProcessors() : void
    protected setNewRelicAppName(string $appName) : void
     

    Sets the NewRelic application that should receive this log.

    protected setNewRelicParameter(string $key, $value) : void
     
      protected setNewRelicTransactionName(string $transactionName) : void
       

      Overwrites the name of the current transaction

      protected write(array $record) : void
       

      {@inheritDoc}

      © 2020 Bruce Wells
      Search Namespaces \ Classes
      ConfigurationNumbers (0-9.) only