]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php
MediaWiki 1.30.2
[autoinstalls/mediawiki.git] / vendor / monolog / monolog / src / Monolog / Processor / TagProcessor.php
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  * Adds a tags array into record
16  *
17  * @author Martijn Riemers
18  */
19 class TagProcessor
20 {
21     private $tags;
22
23     public function __construct(array $tags = array())
24     {
25         $this->setTags($tags);
26     }
27
28     public function addTags(array $tags = array())
29     {
30         $this->tags = array_merge($this->tags, $tags);
31     }
32
33     public function setTags(array $tags = array())
34     {
35         $this->tags = $tags;
36     }
37
38     public function __invoke(array $record)
39     {
40         $record['extra']['tags'] = $this->tags;
41
42         return $record;
43     }
44 }