mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 20:27:31 +02:00
Added docblocks
This commit is contained in:
@@ -30,17 +30,38 @@ abstract class AbstractHandler implements HandlerInterface
|
||||
protected $formatter;
|
||||
protected $processors = array();
|
||||
|
||||
/**
|
||||
* @param integer $level The minimum logging level at which this handler will be triggered
|
||||
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*/
|
||||
public function __construct($level = Logger::DEBUG, $bubble = false)
|
||||
{
|
||||
$this->level = $level;
|
||||
$this->bubble = $bubble;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given record will be handled by this handler
|
||||
*
|
||||
* This is mostly done for performance reasons, to avoid calling processors for nothing.
|
||||
*
|
||||
* @param array $record
|
||||
* @return Boolean True if the record can be handled.
|
||||
*/
|
||||
public function isHandling(array $record)
|
||||
{
|
||||
return $record['level'] >= $this->level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a record
|
||||
*
|
||||
* The return value of this function controls the bubbling process of the handler stack.
|
||||
*
|
||||
* @param array $record
|
||||
* @return 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.
|
||||
*/
|
||||
public function handle(array $record)
|
||||
{
|
||||
if ($record['level'] < $this->level) {
|
||||
@@ -62,6 +83,11 @@ abstract class AbstractHandler implements HandlerInterface
|
||||
return false === $this->bubble;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a set of records at once
|
||||
*
|
||||
* @param array $records array of records
|
||||
*/
|
||||
public function handleBatch(array $records)
|
||||
{
|
||||
foreach ($records as $record) {
|
||||
@@ -69,8 +95,19 @@ abstract class AbstractHandler implements HandlerInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the record down to the log of the implementing handler
|
||||
*
|
||||
* @param array $record
|
||||
* @return void
|
||||
*/
|
||||
abstract public function write(array $record);
|
||||
|
||||
/**
|
||||
* Closes the log
|
||||
*
|
||||
* This will be called automatically when the object is destroyed
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ class RotatingFileHandler extends StreamHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the handler.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
|
@@ -26,6 +26,11 @@ class StreamHandler extends AbstractHandler
|
||||
protected $stream;
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param integer $level
|
||||
* @param Boolean $bubble
|
||||
*/
|
||||
public function __construct($stream, $level = Logger::DEBUG, $bubble = true)
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
@@ -36,6 +41,9 @@ class StreamHandler extends AbstractHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function write(array $record)
|
||||
{
|
||||
if (null === $this->stream) {
|
||||
@@ -51,6 +59,9 @@ class StreamHandler extends AbstractHandler
|
||||
fwrite($this->stream, (string) $record['message']);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
if (null !== $this->stream) {
|
||||
|
Reference in New Issue
Block a user