ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Monolog\Handler\GroupHandler Class Reference

Forwards records to multiple handlers. More...

+ Inheritance diagram for Monolog\Handler\GroupHandler:
+ Collaboration diagram for Monolog\Handler\GroupHandler:

Public Member Functions

 __construct (array $handlers, $bubble=true)
 
 isHandling (array $record)
 {Checks whether the given record will be handled by this handler.This is mostly done for performance reasons, to avoid calling processors for nothing.Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.
Parameters
array$recordPartial log record containing only a level key
Returns
bool
} More...
 
 handle (array $record)
 {Handles a record.All records may be passed to this method, and the handler should discard those that it does not want to handle.The return value of this function controls the bubbling process of the handler stack. Unless the bubbling is interrupted (by returning true), the Logger class will keep on calling further handlers in the stack with a given log record.
Parameters
array$recordThe record to handle
Returns
bool true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.
} More...
 
 handleBatch (array $records)
 {Handles a set of records at once.
Parameters
array$recordsThe records to handle (an array of record arrays)
} More...
 
 reset ()
 
 setFormatter (FormatterInterface $formatter)
 {Sets the formatter.
Parameters
FormatterInterface$formatter
Returns
self
} More...
 
- Public Member Functions inherited from Monolog\Handler\AbstractHandler
 __construct ($level=Logger::DEBUG, $bubble=true)
 
 isHandling (array $record)
 {Checks whether the given record will be handled by this handler.This is mostly done for performance reasons, to avoid calling processors for nothing.Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.
Parameters
array$recordPartial log record containing only a level key
Returns
bool
} More...
 
 handleBatch (array $records)
 {Handles a set of records at once.
Parameters
array$recordsThe records to handle (an array of record arrays)
} More...
 
 close ()
 Closes the handler. More...
 
 pushProcessor ($callback)
 {Adds a processor in the stack.
Parameters
callable$callback
Returns
self
} More...
 
 popProcessor ()
 {Removes the processor on top of the stack and returns it.
Returns
callable
} More...
 
 setFormatter (FormatterInterface $formatter)
 {Sets the formatter.
Parameters
FormatterInterface$formatter
Returns
self
} More...
 
 getFormatter ()
 {Gets the formatter.
Returns
FormatterInterface
} More...
 
 setLevel ($level)
 Sets minimum logging level at which this handler will be triggered. More...
 
 getLevel ()
 Gets minimum logging level at which this handler will be triggered. More...
 
 setBubble ($bubble)
 Sets the bubbling behavior. More...
 
 getBubble ()
 Gets the bubbling behavior. More...
 
 __destruct ()
 
 reset ()
 

Protected Attributes

 $handlers
 
- Protected Attributes inherited from Monolog\Handler\AbstractHandler
 $level = Logger::DEBUG
 
 $bubble = true
 
 $formatter
 
 $processors = array()
 

Additional Inherited Members

- Protected Member Functions inherited from Monolog\Handler\AbstractHandler
 getDefaultFormatter ()
 Gets the default formatter. More...
 

Detailed Description

Forwards records to multiple handlers.

Author
Lenar Lõhmus lenar.nosp@m.@cit.nosp@m.y.ee

Definition at line 22 of file GroupHandler.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Handler\GroupHandler::__construct ( array  $handlers,
  $bubble = true 
)
Parameters
array$handlersArray of Handlers.
bool$bubbleWhether the messages that are handled can bubble up the stack or not

Definition at line 30 of file GroupHandler.php.

References Monolog\Handler\AbstractHandler\$bubble, $handler, and Monolog\Handler\GroupHandler\$handlers.

31  {
32  foreach ($handlers as $handler) {
33  if (!$handler instanceof HandlerInterface) {
34  throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.');
35  }
36  }
37 
38  $this->handlers = $handlers;
39  $this->bubble = $bubble;
40  }
$handler

Member Function Documentation

◆ handle()

Monolog\Handler\GroupHandler::handle ( array  $record)

{Handles a record.All records may be passed to this method, and the handler should discard those that it does not want to handle.The return value of this function controls the bubbling process of the handler stack. Unless the bubbling is interrupted (by returning true), the Logger class will keep on calling further handlers in the stack with a given log record.

Parameters
array$recordThe record to handle
Returns
bool true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 59 of file GroupHandler.php.

References Monolog\Handler\AbstractHandler\$bubble, and $handler.

60  {
61  if ($this->processors) {
62  foreach ($this->processors as $processor) {
63  $record = call_user_func($processor, $record);
64  }
65  }
66 
67  foreach ($this->handlers as $handler) {
68  $handler->handle($record);
69  }
70 
71  return false === $this->bubble;
72  }
$handler

◆ handleBatch()

Monolog\Handler\GroupHandler::handleBatch ( array  $records)

{Handles a set of records at once.

Parameters
array$recordsThe records to handle (an array of record arrays)
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 77 of file GroupHandler.php.

References $handler.

78  {
79  if ($this->processors) {
80  $processed = array();
81  foreach ($records as $record) {
82  foreach ($this->processors as $processor) {
83  $processed[] = call_user_func($processor, $record);
84  }
85  }
86  $records = $processed;
87  }
88 
89  foreach ($this->handlers as $handler) {
90  $handler->handleBatch($records);
91  }
92  }
$records
Definition: simple_test.php:22
$handler

◆ isHandling()

Monolog\Handler\GroupHandler::isHandling ( array  $record)

{Checks whether the given record will be handled by this handler.This is mostly done for performance reasons, to avoid calling processors for nothing.Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.

Parameters
array$recordPartial log record containing only a level key
Returns
bool
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 45 of file GroupHandler.php.

References $handler.

46  {
47  foreach ($this->handlers as $handler) {
48  if ($handler->isHandling($record)) {
49  return true;
50  }
51  }
52 
53  return false;
54  }
$handler

◆ reset()

Monolog\Handler\GroupHandler::reset ( )

Implements Monolog\ResettableInterface.

Definition at line 94 of file GroupHandler.php.

References $handler.

95  {
96  parent::reset();
97 
98  foreach ($this->handlers as $handler) {
99  if ($handler instanceof ResettableInterface) {
100  $handler->reset();
101  }
102  }
103  }
$handler

◆ setFormatter()

Monolog\Handler\GroupHandler::setFormatter ( FormatterInterface  $formatter)

{Sets the formatter.

Parameters
FormatterInterface$formatter
Returns
self
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 108 of file GroupHandler.php.

References $handler.

109  {
110  foreach ($this->handlers as $handler) {
111  $handler->setFormatter($formatter);
112  }
113 
114  return $this;
115  }
$handler

Field Documentation

◆ $handlers

Monolog\Handler\GroupHandler::$handlers
protected

Definition at line 24 of file GroupHandler.php.

Referenced by Monolog\Handler\GroupHandler\__construct().


The documentation for this class was generated from the following file: