Skip to content
This repository
Browse code

Better naming

  • Loading branch information...
commit 9cf31da70da9abb6a198c3628c6a9897acffa945 1 parent bad76ce
Simon Mönch authored
2  README.mdown
Source Rendered
@@ -184,7 +184,7 @@ Processors
184 184 - _MemoryUsageProcessor_: Adds the current memory usage to a log record.
185 185 - _MemoryPeakUsageProcessor_: Adds the peak memory usage to a log record.
186 186 - _ProcessIdProcessor_: Adds the process id to a log record.
187   -- _RequestTokenProcessor_: Adds a request token to a log record.
  187 +- _UidProcessor_: Adds a unique identifier to a log record.
188 188
189 189 About
190 190 =====
12 src/Monolog/Processor/RequestTokenProcessor.php → src/Monolog/Processor/UidProcessor.php
@@ -12,24 +12,24 @@
12 12 namespace Monolog\Processor;
13 13
14 14 /**
15   - * Adds a request token into records
  15 + * Adds a unique identifier into records
16 16 *
17 17 * @author Simon Mönch <sm@webfactory.de>
18 18 */
19   -class RequestTokenProcessor
  19 +class UidProcessor
20 20 {
21   - private static $requestToken;
  21 + private static $uid;
22 22
23 23 public function __construct()
24 24 {
25   - if (null === self::$requestToken) {
26   - self::$requestToken = substr(hash('md5', uniqid('', true)), 0, 7);
  25 + if (null === self::$uid) {
  26 + self::$uid = substr(hash('md5', uniqid('', true)), 0, 7);
27 27 }
28 28 }
29 29
30 30 public function __invoke(array $record)
31 31 {
32   - $record['extra']['request_token'] = self::$requestToken;
  32 + $record['extra']['uid'] = self::$uid;
33 33
34 34 return $record;
35 35 }
8 ...s/Monolog/Processor/RequestTokenProcessorTest.php → tests/Monolog/Processor/UidProcessorTest.php
@@ -13,15 +13,15 @@
13 13
14 14 use Monolog\TestCase;
15 15
16   -class RequestTokenProcessorTest extends TestCase
  16 +class UidProcessorTest extends TestCase
17 17 {
18 18 /**
19   - * @covers Monolog\Processor\RequestTokenProcessor::__invoke
  19 + * @covers Monolog\Processor\UidProcessor::__invoke
20 20 */
21 21 public function testProcessor()
22 22 {
23   - $processor = new RequestTokenProcessor();
  23 + $processor = new UidProcessor();
24 24 $record = $processor($this->getRecord());
25   - $this->assertArrayHasKey('request_token', $record['extra']);
  25 + $this->assertArrayHasKey('uid', $record['extra']);
26 26 }
27 27 }

0 comments on commit 9cf31da

Please sign in to comment.
Something went wrong with that request. Please try again.