|
|
@@ -30,10 +30,12 @@ class BufferHandler extends AbstractHandler
|
|
|
/**
|
|
|
* @param HandlerInterface $handler Handler.
|
|
|
* @param integer $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
|
|
|
+ * @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(HandlerInterface $handler, $bufferSize = 0, $bubble = false)
|
|
|
+ public function __construct(HandlerInterface $handler, $bufferSize = 0, $level = Logger::DEBUG, $bubble = false)
|
|
|
{
|
|
|
+ parent::__construct($level, $bubble);
|
|
|
$this->handler = $handler;
|
|
|
$this->bufferSize = $bufferSize;
|
|
|
$this->bubble = $bubble;
|
|
|
@@ -44,6 +46,10 @@ class BufferHandler extends AbstractHandler
|
|
|
*/
|
|
|
public function handle(array $record)
|
|
|
{
|
|
|
+ if ($record['level'] < $this->level) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
$this->buffer[] = $record;
|
|
|
if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
|
|
|
array_shift($this->buffer);
|