ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
Boolean
} 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
Boolean 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...
 
 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
Boolean
} 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 ()
 

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 21 of file GroupHandler.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 29 of file GroupHandler.php.

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

30  {
31  foreach ($handlers as $handler) {
32  if (!$handler instanceof HandlerInterface) {
33  throw new \InvalidArgumentException('The first argument of the GroupHandler must be an array of HandlerInterface instances.');
34  }
35  }
36 
37  $this->handlers = $handlers;
38  $this->bubble = $bubble;
39  }
$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
Boolean 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 58 of file GroupHandler.php.

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

59  {
60  if ($this->processors) {
61  foreach ($this->processors as $processor) {
62  $record = call_user_func($processor, $record);
63  }
64  }
65 
66  foreach ($this->handlers as $handler) {
67  $handler->handle($record);
68  }
69 
70  return false === $this->bubble;
71  }
$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 76 of file GroupHandler.php.

References $handler, and array.

77  {
78  if ($this->processors) {
79  $processed = array();
80  foreach ($records as $record) {
81  foreach ($this->processors as $processor) {
82  $processed[] = call_user_func($processor, $record);
83  }
84  }
85  $records = $processed;
86  }
87 
88  foreach ($this->handlers as $handler) {
89  $handler->handleBatch($records);
90  }
91  }
$records
Definition: simple_test.php:22
Create styles array
The data for the language used.
$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
Boolean
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 44 of file GroupHandler.php.

References $handler.

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

◆ setFormatter()

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

{Sets the formatter.

Parameters
FormatterInterface$formatter
Returns
self
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 96 of file GroupHandler.php.

References $handler.

97  {
98  foreach ($this->handlers as $handler) {
99  $handler->setFormatter($formatter);
100  }
101 
102  return $this;
103  }
$handler

Field Documentation

◆ $handlers

Monolog\Handler\GroupHandler::$handlers
protected

Definition at line 23 of file GroupHandler.php.

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


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