CurrentUserProcessor.php in Monolog 8
File
src/Logger/Processor/CurrentUserProcessor.php
View source
<?php
namespace Drupal\monolog\Logger\Processor;
use Drupal\Core\Session\AccountProxyInterface;
class CurrentUserProcessor {
protected $accountProxy;
public function __construct(AccountProxyInterface $account_proxy) {
$this->accountProxy = $account_proxy;
}
public function __invoke(array $record) {
$record['extra']['uid'] = $this->accountProxy
->id();
$record['extra']['user'] = $this->accountProxy
->getAccountName();
return $record;
}
}