You are here

public function JsonLogData::setAccount in JSONlog 8

Same name and namespace in other branches
  1. 8.2 src/Logger/JsonLogData.php \Drupal\jsonlog\Logger\JsonLogData::setAccount()
  2. 3.x src/Logger/JsonLogData.php \Drupal\jsonlog\Logger\JsonLogData::setAccount()

Parameters

\Drupal\Core\Session\AccountProxyInterface|NULL $account:

File

src/Logger/JsonLogData.php, line 149

Class

JsonLogData

Namespace

Drupal\jsonlog\Logger

Code

public function setAccount($account) {
  if ($account) {
    $this->uid = $account
      ->id();
    $this->username = $account
      ->getAccountName();
  }
  else {
    $this->uid = 0;
    $this->username = '';
  }
}