4 * This file is part of the Monolog package.
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Monolog\Handler;
14 use Monolog\Formatter\FormatterInterface;
17 * This simple wrapper class can be used to extend handlers functionality.
19 * Example: A filtering handle. Inherit from this class, override isHandling() like this
21 * public function isHandling(array $record)
23 * if ($record meets certain conditions) {
26 * return $this->handler->isHandling($record);
29 * @author Alexey Karapetov <alexey@karapetov.com>
31 class HandlerWrapper implements HandlerInterface
34 * @var HandlerInterface
39 * HandlerWrapper constructor.
40 * @param HandlerInterface $handler
42 public function __construct(HandlerInterface $handler)
44 $this->handler = $handler;
50 public function isHandling(array $record)
52 return $this->handler->isHandling($record);
58 public function handle(array $record)
60 return $this->handler->handle($record);
66 public function handleBatch(array $records)
68 return $this->handler->handleBatch($records);
74 public function pushProcessor($callback)
76 $this->handler->pushProcessor($callback);
84 public function popProcessor()
86 return $this->handler->popProcessor();
92 public function setFormatter(FormatterInterface $formatter)
94 $this->handler->setFormatter($formatter);
102 public function getFormatter()
104 return $this->handler->getFormatter();