ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
GroupHandler.php
Go to the documentation of this file.
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
12namespace Monolog\Handler;
13
20{
21 protected $handlers;
22
27 public function __construct(array $handlers, $bubble = true)
28 {
29 foreach ($handlers as $handler) {
30 if (!$handler instanceof HandlerInterface) {
31 throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.');
32 }
33 }
34
35 $this->handlers = $handlers;
36 $this->bubble = $bubble;
37 }
38
42 public function isHandling(array $record)
43 {
44 foreach ($this->handlers as $handler) {
45 if ($handler->isHandling($record)) {
46 return true;
47 }
48 }
49
50 return false;
51 }
52
56 public function handle(array $record)
57 {
58 if ($this->processors) {
59 foreach ($this->processors as $processor) {
60 $record = call_user_func($processor, $record);
61 }
62 }
63
64 foreach ($this->handlers as $handler) {
65 $handler->handle($record);
66 }
67
68 return false === $this->bubble;
69 }
70
74 public function handleBatch(array $records)
75 {
76 foreach ($this->handlers as $handler) {
77 $handler->handleBatch($records);
78 }
79 }
80}
Base Handler class providing the Handler structure.
Forwards records to multiple handlers.
handle(array $record)
{Handles a record.All records may be passed to this method, and the handler should discard those that...
isHandling(array $record)
{{Checks whether the given record will be handled by this handler.This is mostly done for performance...
__construct(array $handlers, $bubble=true)
handleBatch(array $records)
{{Handles a set of records at once.}}
Interface that all Monolog Handlers must implement.
$records
Definition: simple_test.php:17