You are here

IpProcessor.php in Monolog 2.x

Same filename and directory in other branches
  1. 8 src/Logger/Processor/IpProcessor.php

File

src/Logger/Processor/IpProcessor.php
View source
<?php

namespace Drupal\monolog\Logger\Processor;


/**
 * Class IpProcessor.
 */
class IpProcessor extends AbstractRequestProcessor {

  /**
   * {@inheritdoc}
   */
  public function __invoke(array $record) {
    if ($request = $this
      ->getRequest()) {
      $record['extra']['ip'] = $request
        ->getClientIp();
    }
    return $record;
  }

}

Classes

Namesort descending Description
IpProcessor Class IpProcessor.