mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-13 16:44:23 +02:00
Added a TagProcessor
The TagProcessor adds the tags key to the record making it so that it can be used by handlers like Raven.
This commit is contained in:
37
src/Monolog/Processor/TagProcessor.php
Normal file
37
src/Monolog/Processor/TagProcessor.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Monolog package.
|
||||||
|
*
|
||||||
|
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Monolog\Processor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a tags array into record
|
||||||
|
*
|
||||||
|
* @author Martijn Riemers
|
||||||
|
*/
|
||||||
|
class TagProcessor
|
||||||
|
{
|
||||||
|
private $tags;
|
||||||
|
|
||||||
|
public function __construct(array $tags = array())
|
||||||
|
{
|
||||||
|
$this->tags = $tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __invoke(array $record)
|
||||||
|
{
|
||||||
|
$record['tags'] = array_merge(
|
||||||
|
$this->tags,
|
||||||
|
$record['tags']
|
||||||
|
);
|
||||||
|
|
||||||
|
return $record;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user