You are here

public function JsonLogData::setAccount in JSONlog 3.x

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

Parameters

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

Deprecated

in 8.x-1.4 and removed from 2.0. Users of this class should use JsonLogData::setUid() instead.

See also

https://www.drupal.org/project/jsonlog/issues/3213933

https://www.drupal.org/project/drupal/issues/2986294

File

src/Logger/JsonLogData.php, line 165

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 = '';
  }
}