scratch – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
115 | office | 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\Handler; |
||
13 | |||
14 | /** |
||
15 | * Base Handler class providing the Handler structure |
||
16 | * |
||
17 | * Classes extending it should (in most cases) only implement write($record) |
||
18 | * |
||
19 | * @author Jordi Boggiano <j.boggiano@seld.be> |
||
20 | * @author Christophe Coevoet <stof@notk.org> |
||
21 | */ |
||
22 | abstract class AbstractProcessingHandler extends AbstractHandler |
||
23 | { |
||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | public function handle(array $record) |
||
28 | { |
||
29 | if (!$this->isHandling($record)) { |
||
30 | return false; |
||
31 | } |
||
32 | |||
33 | $record = $this->processRecord($record); |
||
34 | |||
35 | $record['formatted'] = $this->getFormatter()->format($record); |
||
36 | |||
37 | $this->write($record); |
||
38 | |||
39 | return false === $this->bubble; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Writes the record down to the log of the implementing handler |
||
44 | * |
||
45 | * @param array $record |
||
46 | * @return void |
||
47 | */ |
||
48 | abstract protected function write(array $record); |
||
49 | |||
50 | /** |
||
51 | * Processes a record. |
||
52 | * |
||
53 | * @param array $record |
||
54 | * @return array |
||
55 | */ |
||
56 | protected function processRecord(array $record) |
||
57 | { |
||
58 | if ($this->processors) { |
||
59 | foreach ($this->processors as $processor) { |
||
60 | $record = call_user_func($processor, $record); |
||
61 | } |
||
62 | } |
||
63 | |||
64 | return $record; |
||
65 | } |
||
66 | } |