Plop
A simple logging library for PHP
|
A class that provides logging capabilities. More...
Public Member Functions | |
__construct ($ns=null, $cls=null, $method=null,\Plop\HandlersCollectionAbstract $handlers=null,\Plop\FiltersCollectionAbstract $filters=null) | |
getClass () | |
getFilters () | |
getHandlers () | |
getLevel () | |
getMethod () | |
getNamespace () | |
getRecordFactory () | |
isEnabledFor ($level) | |
log ($level, $msg, array $args=array(),\Exception $exception=null) | |
setFilters (\Plop\FiltersCollectionAbstract $filters) | |
setHandlers (\Plop\HandlersCollectionAbstract $handlers) | |
setLevel ($level) | |
setRecordFactory (\Plop\RecordFactoryInterface $factory) | |
Public Member Functions inherited from Plop\LoggerAbstract | |
alert ($msg, array $args=array(),\Exception $exception=null) | |
critical ($msg, array $args=array(),\Exception $exception=null) | |
debug ($msg, array $args=array(),\Exception $exception=null) | |
emergency ($msg, array $args=array(),\Exception $exception=null) | |
error ($msg, array $args=array(),\Exception $exception=null) | |
exception ($msg,\Exception $exception, array $args=array()) | |
info ($msg, array $args=array(),\Exception $exception=null) | |
notice ($msg, array $args=array(),\Exception $exception=null) | |
warn ($msg, array $args=array(),\Exception $exception=null) | |
warning ($msg, array $args=array(),\Exception $exception=null) | |
Protected Member Functions | |
callHandlers (\Plop\RecordInterface $record) | |
getStderr () | |
handle (\Plop\RecordInterface $record) | |
Protected Attributes | |
$cls | |
Name of the class this logger relates to. | |
$emittedWarning | |
Whether a warning has been emitted about this logger having no handlers. | |
$filters | |
An object handling a collection of filters. | |
$handlers | |
A collection of handlers currently associated with this logger. | |
$level | |
Minimum level at which this logger will accept log entries. | |
$method | |
Name of the method or function this logger relates to. | |
$ns | |
Name of the namespace this logger relates to. | |
A class that provides logging capabilities.
Definition at line 27 of file Logger.php.
Plop\Logger::__construct | ( | $ns = null , |
|
$cls = null , |
|||
$method = null , |
|||
\Plop\HandlersCollectionAbstract | $handlers = null , |
||
\Plop\FiltersCollectionAbstract | $filters = null |
||
) |
Construct a new logger with no attached handlers and that accepts any log entry.
string | null | $ns | (optional) The name of the namespace this logger relates to. The default is null (meaning this logger is related to the global namespace). |
string | null | $cls | (optional) The name of the class this logger relates to. The default is null (meaning this logger is not related to any specific class). |
string | null | $method | (optional) The name of the method or function this logger relates to. The default is null (meaning this logger is not related to any specific method or function). |
Plop::HandlersCollectionAbstract | $handlers | (optional) A collection of handlers to associate with this logger. Defaults to an empty list. |
Plop::FiltersCollectionAbstract | $filters | (optional) A collection of filters to associate with this logger. Defaults to an empty list. |
Definition at line 79 of file Logger.php.
|
protected |
Call every handler associated with this logger in turn, passing them a log record to handle.
Plop::RecordInterface | $record | The log record to handle. |
Plop::LoggerInterface | The logger instance (ie. $this). |
Definition at line 232 of file Logger.php.
Plop\Logger::getClass | ( | ) |
Return the name of the class this logger applies to.
string | Name of the class this logger relates to. |
Implements Plop\LoggerInterface.
Definition at line 127 of file Logger.php.
Plop\Logger::getFilters | ( | ) |
Get the collection of filters currently associated with this logger.
Plop::FiltersCollectionAbstract | Collection of filters associated with this logger. |
Implements Plop\LoggerInterface.
Definition at line 152 of file Logger.php.
Plop\Logger::getHandlers | ( | ) |
Get the collection of handlers currently associated with this logger.
Plop::HandlersCollectionAbstract | Collection of handlers associated with this logger. |
Implements Plop\LoggerInterface.
Definition at line 165 of file Logger.php.
Plop\Logger::getLevel | ( | ) |
Return the minimum level a log record must have to be handled by this class.
int | Minimum level at which log records will be accepted. |
Implements Plop\LoggerInterface.
Definition at line 269 of file Logger.php.
Plop\Logger::getMethod | ( | ) |
Return the name of the method or function this logger applies to.
string | Name of the method/function this logger relates to. |
Implements Plop\LoggerInterface.
Definition at line 133 of file Logger.php.
Plop\Logger::getNamespace | ( | ) |
Return the name of the namespace this logger applies to.
string | Name of the namespace this logger relates to. |
Implements Plop\LoggerInterface.
Definition at line 121 of file Logger.php.
Plop\Logger::getRecordFactory | ( | ) |
Return the factory used to produce log records.
Plop::RecordFactoryInterface | The factory used to produce records. |
Implements Plop\LoggerInterface.
Definition at line 139 of file Logger.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 263 of file Logger.php.
|
protected |
Handle a log record.
Plop::RecordInterface | $record | The log record to handle. |
Plop::LoggerInterface | The logger instance (ie. $this). |
Definition at line 214 of file Logger.php.
Plop\Logger::isEnabledFor | ( | $level | ) |
Implements Plop\LoggerInterface.
Definition at line 286 of file Logger.php.
References Plop\Plop\getInstance().
Plop\Logger::log | ( | $level, | |
$msg, | |||
array | $args = array() , |
||
\Exception | $exception = null |
||
) |
Implements Plop\LoggerInterface.
Definition at line 178 of file Logger.php.
References Plop\Plop\findCaller().
Plop\Logger::setFilters | ( | \Plop\FiltersCollectionAbstract | $filters | ) |
Implements Plop\LoggerInterface.
Definition at line 158 of file Logger.php.
Plop\Logger::setHandlers | ( | \Plop\HandlersCollectionAbstract | $handlers | ) |
Implements Plop\LoggerInterface.
Definition at line 171 of file Logger.php.
Plop\Logger::setLevel | ( | $level | ) |
Implements Plop\LoggerInterface.
Definition at line 275 of file Logger.php.
References Plop\Plop\getInstance().
Plop\Logger::setRecordFactory | ( | \Plop\RecordFactoryInterface | $factory | ) |
Implements Plop\LoggerInterface.
Definition at line 145 of file Logger.php.