equal
deleted
inserted
replaced
|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Monolog package. |
|
5 * |
|
6 * (c) Jordi Boggiano <j.boggiano@seld.be> |
|
7 * |
|
8 * For the full copyright and license information, please view the LICENSE |
|
9 * file that was distributed with this source code. |
|
10 */ |
|
11 |
|
12 namespace Monolog\Processor; |
|
13 |
|
14 /** |
|
15 * Injects memory_get_peak_usage in all records |
|
16 * |
|
17 * @see Monolog\Processor\MemoryProcessor::__construct() for options |
|
18 * @author Rob Jensen |
|
19 */ |
|
20 class MemoryPeakUsageProcessor extends MemoryProcessor |
|
21 { |
|
22 /** |
|
23 * @param array $record |
|
24 * @return array |
|
25 */ |
|
26 public function __invoke(array $record) |
|
27 { |
|
28 $bytes = memory_get_peak_usage($this->realUsage); |
|
29 $formatted = self::formatBytes($bytes); |
|
30 |
|
31 $record['extra'] = array_merge( |
|
32 $record['extra'], |
|
33 array( |
|
34 'memory_peak_usage' => $formatted, |
|
35 ) |
|
36 ); |
|
37 |
|
38 return $record; |
|
39 } |
|
40 } |