ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Monolog\Processor\UidProcessor Class Reference

Adds a unique identifier into records. More...

+ Collaboration diagram for Monolog\Processor\UidProcessor:

Public Member Functions

 __construct ($length=7)
 
 __invoke (array $record)
 
 getUid ()
 

Private Attributes

 $uid
 

Detailed Description

Adds a unique identifier into records.

Author
Simon Mönch sm@we.nosp@m.bfac.nosp@m.tory..nosp@m.de

Definition at line 19 of file UidProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Processor\UidProcessor::__construct (   $length = 7)

Definition at line 23 of file UidProcessor.php.

24  {
25  if (!is_int($length) || $length > 32 || $length < 1) {
26  throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32');
27  }
28 
29  $this->uid = substr(hash('md5', uniqid('', true)), 0, $length);
30  }

Member Function Documentation

◆ __invoke()

Monolog\Processor\UidProcessor::__invoke ( array  $record)

Definition at line 32 of file UidProcessor.php.

References Monolog\Processor\UidProcessor\$uid.

33  {
34  $record['extra']['uid'] = $this->uid;
35 
36  return $record;
37  }

◆ getUid()

Monolog\Processor\UidProcessor::getUid ( )
Returns
string

Definition at line 42 of file UidProcessor.php.

References Monolog\Processor\UidProcessor\$uid.

43  {
44  return $this->uid;
45  }

Field Documentation

◆ $uid

Monolog\Processor\UidProcessor::$uid
private

The documentation for this class was generated from the following file: