86 if ($handlers === null) {
87 $handlers = new \Plop\HandlersCollection();
89 if ($filters === null) {
90 $filters = new \Plop\FiltersCollection();
93 while (substr($ns, -strlen(
'\\')) ==
'\\') {
94 $ns = (string) substr($ns, 0, -strlen(
'\\'));
99 $cls = (string) substr($cls, strrpos(
'\\' . $cls,
'\\'));
105 $method = (string) substr($method, strrpos(
'\\' . $method,
'\\'));
106 if ($method ===
'') {
112 $this->method = $method;
113 $this->level = \Plop\NOTSET;
114 $this->handlers = $handlers;
115 $this->emittedWarning =
false;
116 $this->filters = $filters;
135 return $this->method;
141 return $this->recordFactory;
147 $this->recordFactory = $factory;
154 return $this->filters;
160 $this->filters = $filters;
167 return $this->handlers;
173 $this->handlers = $handlers;
181 array $args = array(),
184 if ($this->isEnabledFor($level)) {
186 $record = $this->recordFactory->createRecord(
194 $caller[
'file'] ? $caller[
'file'] :
'???',
200 $this->handle($record);
216 if ($this->filters->filter($record)) {
217 $this->callHandlers($record);
234 if (!count($this->handlers) && !$this->emittedWarning) {
235 $stderr = $this->getStderr();
238 'No handlers could be found for logger ("%s" in "%s")' .
"\n",
240 ($this->cls === null || $this->cls ===
'' ?
'' :
'::') .
245 $this->emittedWarning =
true;
249 $this->handlers->handle($record);
265 return fopen(
'php://stderr',
'at');
277 if (!is_int($level)) {
279 $level = $plop->getLevelValue($level);
281 $this->level = $level;
288 if (!is_int($level)) {
290 $level = $plop->getLevelValue($level);
292 return ($level >= $this->level);
setFilters(\Plop\FiltersCollectionAbstract $filters)
setHandlers(\Plop\HandlersCollectionAbstract $handlers)
An interface for a factory that produces instances that implement the Plop::RecordInterface interface...
__construct($ns=null, $cls=null, $method=null,\Plop\HandlersCollectionAbstract $handlers=null,\Plop\FiltersCollectionAbstract $filters=null)
An abstract class that can be used as a base to create new loggers.
Interface for a log record.
$filters
An object handling a collection of filters.
A factory that creates log records as new instances of the Plop::Record class.
handle(\Plop\RecordInterface $record)
log($level, $msg, array $args=array(),\Exception $exception=null)
callHandlers(\Plop\RecordInterface $record)
Abstract class for a collection of filters.
$handlers
A collection of handlers currently associated with this logger.
$cls
Name of the class this logger relates to.
$ns
Name of the namespace this logger relates to.
This exception is thrown by Plop whenever a problem is detected.
setRecordFactory(\Plop\RecordFactoryInterface $factory)
$level
Minimum level at which this logger will accept log entries.
$emittedWarning
Whether a warning has been emitted about this logger having no handlers.
$method
Name of the method or function this logger relates to.
Interface for a collection of handlers.
A class that provides logging capabilities.