ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Monolog\Handler\HandlerWrapper Class Reference

This simple wrapper class can be used to extend handlers functionality. More...

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

Public Member Functions

 __construct (HandlerInterface $handler)
 HandlerWrapper constructor. More...
 
 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...
 
 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...
 

Protected Attributes

 $handler
 

Detailed Description

This simple wrapper class can be used to extend handlers functionality.

Example: A filtering handle. Inherit from this class, override isHandling() like this

public function isHandling(array $record) { if ($record meets certain conditions) { return false; } return $this->handler->isHandling($record); }

Author
Alexey Karapetov alexe.nosp@m.y@ka.nosp@m.rapet.nosp@m.ov.c.nosp@m.om

Definition at line 31 of file HandlerWrapper.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Handler\HandlerWrapper::__construct ( HandlerInterface  $handler)

HandlerWrapper constructor.

Parameters
HandlerInterface$handler

Definition at line 42 of file HandlerWrapper.php.

References Monolog\Handler\HandlerWrapper\$handler.

43  {
44  $this->handler = $handler;
45  }

Member Function Documentation

◆ getFormatter()

Monolog\Handler\HandlerWrapper::getFormatter ( )

{Gets the formatter.

Returns
FormatterInterface
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 102 of file HandlerWrapper.php.

103  {
104  return $this->handler->getFormatter();
105  }

◆ handle()

Monolog\Handler\HandlerWrapper::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 HandlerWrapper.php.

59  {
60  return $this->handler->handle($record);
61  }

◆ handleBatch()

Monolog\Handler\HandlerWrapper::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 66 of file HandlerWrapper.php.

67  {
68  return $this->handler->handleBatch($records);
69  }
$records
Definition: simple_test.php:22

◆ isHandling()

Monolog\Handler\HandlerWrapper::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 50 of file HandlerWrapper.php.

51  {
52  return $this->handler->isHandling($record);
53  }

◆ popProcessor()

Monolog\Handler\HandlerWrapper::popProcessor ( )

{Removes the processor on top of the stack and returns it.

Returns
callable
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 84 of file HandlerWrapper.php.

85  {
86  return $this->handler->popProcessor();
87  }

◆ pushProcessor()

Monolog\Handler\HandlerWrapper::pushProcessor (   $callback)

{Adds a processor in the stack.

Parameters
callable$callback
Returns
self
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 74 of file HandlerWrapper.php.

75  {
76  $this->handler->pushProcessor($callback);
77 
78  return $this;
79  }

◆ setFormatter()

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

{Sets the formatter.

Parameters
FormatterInterface$formatter
Returns
self
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 92 of file HandlerWrapper.php.

93  {
94  $this->handler->setFormatter($formatter);
95 
96  return $this;
97  }

Field Documentation

◆ $handler

Monolog\Handler\HandlerWrapper::$handler
protected

Definition at line 36 of file HandlerWrapper.php.

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


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