You are here

class CurrentUserProcessor in Monolog 2.x

Same name and namespace in other branches
  1. 8 src/Logger/Processor/CurrentUserProcessor.php \Drupal\monolog\Logger\Processor\CurrentUserProcessor

Class UidProcessor.

Hierarchy

Expanded class hierarchy of CurrentUserProcessor

1 string reference to 'CurrentUserProcessor'
monolog.services.yml in ./monolog.services.yml
monolog.services.yml
1 service uses CurrentUserProcessor
monolog.processor.current_user in ./monolog.services.yml
Drupal\monolog\Logger\Processor\CurrentUserProcessor

File

src/Logger/Processor/CurrentUserProcessor.php, line 10

Namespace

Drupal\monolog\Logger\Processor
View source
class CurrentUserProcessor {

  /**
   * \Drupal\Core\Session\AccountProxyInterface $account_proxy.
   *
   * @var \Drupal\Core\Session\AccountProxyInterface
   */
  protected $accountProxy;

  /**
   * Constructs a Default object.
   *
   * @param \Drupal\Core\Session\AccountProxyInterface $account_proxy
   *  The AccountProxyInterface definition.
   */
  public function __construct(AccountProxyInterface $account_proxy) {
    $this->accountProxy = $account_proxy;
  }

  /**
   * {@inheritdoc}
   */
  public function __invoke(array $record) {
    $record['extra']['uid'] = $this->accountProxy
      ->id();
    $record['extra']['user'] = $this->accountProxy
      ->getAccountName();
    return $record;
  }

}

Members