|
Plop
A simple logging library for PHP
|
An abstract class that can be used as a base to create new log records handlers. More...
Inheritance diagram for Plop\HandlerAbstract:Public Member Functions | |
| __construct (\Plop\FormatterInterface $formatter=null,\Plop\FiltersCollectionAbstract $filters=null) | |
| getFilters () | |
| getFormatter () | |
| handle (\Plop\RecordInterface $record) | |
| handleError (\Plop\RecordInterface $record,\Exception $exception) | |
| setFilters (\Plop\FiltersCollectionAbstract $filters) | |
| setFormatter (\Plop\FormatterInterface $formatter) | |
Protected Member Functions | |
| emit (\Plop\RecordInterface $record) | |
| format (\Plop\RecordInterface $record) | |
| getStderr () | |
Protected Attributes | |
| $filters | |
| An object handling a collection of filters. | |
| $formatter | |
| Formatter object to use for this handler. | |
An abstract class that can be used as a base to create new log records handlers.
Subclasses must implement the _emit() method.
Definition at line 30 of file HandlerAbstract.php.
| Plop\HandlerAbstract::__construct | ( | \Plop\FormatterInterface | $formatter = null, |
| \Plop\FiltersCollectionAbstract | $filters = null |
||
| ) |
Create a new handler that accepts any log record.
| Plop::FormatterInterface | $formatter | (optional) The formatter this handler will use to render records. By default, a new instance of Plop::Formatter is created. |
| Plop::FiltersCollectionAbstract | $filters | (optional) A collection of filters to associate with this handler. Defaults to an empty list. |
Definition at line 50 of file HandlerAbstract.php.
|
abstractprotected |
Send the log to its final destination.
| Plop::RecordInterface | $record | The record to log. |
|
protected |
Format a record.
| Plop::RecordInterface | $record | The record to format. |
| string | Formatted representation of the record. |
Definition at line 99 of file HandlerAbstract.php.
Referenced by Plop\Handler\Stream\emit(), Plop\Handler\SysLog\emit(), and Plop\Handler\RotatingFile\shouldRollover().
| Plop\HandlerAbstract::getFilters | ( | ) |
Get the collection of filters currently associated with this handler.
| Plop::FiltersCollectionAbstract | Collection of filters associated with this handler. |
Implements Plop\HandlerInterface.
Definition at line 78 of file HandlerAbstract.php.
| Plop\HandlerAbstract::getFormatter | ( | ) |
Return the formatter used by this handler.
| Plop::FormatterInterface | Formatter object used by this handler. |
Implements Plop\HandlerInterface.
Definition at line 65 of file HandlerAbstract.php.
|
protected |
Return STDERR as a (closable) stream. This method only exists to provide an easy way to mock STDERR in unit tests.
| resource | STDERR as a closable stream. |
Definition at line 135 of file HandlerAbstract.php.
| Plop\HandlerAbstract::handle | ( | \Plop\RecordInterface | $record | ) |
Handle a log record.
| Plop::RecordInterface | $record | The log record to handle. |
| Plop::HandlerInterface | The handler instance (ie. $this). |
Implements Plop\HandlerInterface.
Definition at line 116 of file HandlerAbstract.php.
| Plop\HandlerAbstract::handleError | ( | \Plop\RecordInterface | $record, |
| \Exception | $exception | ||
| ) |
Handle an exception that occurred during log record handling.
| Plop::RecordInterface | $record | The log record that was being handled when the exception occurred. |
| Exception | $exception | The actual exception. |
| Plop::HandlerInterface | The handler instance (ie. $this). |
Implements Plop\HandlerInterface.
Definition at line 141 of file HandlerAbstract.php.
Referenced by Plop\Handler\RotatingAbstract\emit(), and Plop\Handler\SysLog\emit().
| Plop\HandlerAbstract::setFilters | ( | \Plop\FiltersCollectionAbstract | $filters | ) |
Set the collection of filters associated with this handler.
| Plop::FiltersCollectionAbstract | $filters | New collection of filters to associate with this handler. |
| Plop::HandlerInterface | The handler instance (ie. $this). |
Implements Plop\HandlerInterface.
Definition at line 84 of file HandlerAbstract.php.
| Plop\HandlerAbstract::setFormatter | ( | \Plop\FormatterInterface | $formatter | ) |
Set the new formatter to use.
| Plop::FormatterInterface | $formatter | The new formatter object to use to format log records. |
| Plop::HandlerInterface | The handler instance (ie. $this). |
Implements Plop\HandlerInterface.
Definition at line 71 of file HandlerAbstract.php.