1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-23 09:36:11 +02:00

Renamed message to record

This commit is contained in:
Jordi Boggiano
2011-02-25 22:54:01 +01:00
parent efc2bd656b
commit 6c24217c56
16 changed files with 175 additions and 176 deletions

View File

@@ -14,11 +14,11 @@ namespace Monolog\Handler;
use Monolog\Logger;
/**
* Buffers all messages until a certain level is reached
* Buffers all records until a certain level is reached
*
* The advantage of this approach is that you don't get any clutter in your log files.
* Only requests which actually trigger an error (or whatever your actionLevel is) will be
* in the logs, but they will contain all messages, not only those above the level threshold.
* in the logs, but they will contain all records, not only those above the level threshold.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
@@ -31,7 +31,7 @@ class FingersCrossedHandler extends AbstractHandler
protected $buffer = array();
/**
* @param callback|HandlerInterface $handler Handler or factory callback($message, $fingersCrossedHandler).
* @param callback|HandlerInterface $handler Handler or factory callback($record, $fingersCrossedHandler).
* @param int $actionLevel The level at which this handler is triggered.
* @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
* @param Boolean $bubble
@@ -45,39 +45,39 @@ class FingersCrossedHandler extends AbstractHandler
}
/**
* Handles a message
* Handles a record
*
* Messages are buffered until one of them matches the actionLevel. From then
* on, unless reset() is called, all messages are passed to the wrapped handler.
* Records are buffered until one of them matches the actionLevel. From then
* on, unless reset() is called, all records are passed to the wrapped handler.
*
* @param array $message Message
* @return Boolean Whether the message was handled
* @param array $record Records
* @return Boolean Whether the record was handled
*/
public function handle($message)
public function handle($record)
{
if ($this->buffering) {
$this->buffer[] = $message;
$this->buffer[] = $record;
if ($this->bufferSize > 0 && count($this->buffer) > $this->bufferSize) {
array_shift($this->buffer);
}
if ($message['level'] >= $this->actionLevel) {
if ($record['level'] >= $this->actionLevel) {
$this->buffering = false;
if (!$this->handler instanceof AbstractHandler) {
$this->handler = $this->handler($message, $this);
$this->handler = $this->handler($record, $this);
}
foreach ($this->buffer as $message) {
$this->handler->handle($message);
foreach ($this->buffer as $record) {
$this->handler->handle($record);
}
$this->buffer = array();
}
} else {
$this->handler->handle($message);
$this->handler->handle($record);
}
return false === $this->bubble;
}
/**
* Resets the state of the handler. Stops forwarding messages to the wrapped handler.
* Resets the state of the handler. Stops forwarding records to the wrapped handler.
*/
public function reset()
{
@@ -87,7 +87,7 @@ class FingersCrossedHandler extends AbstractHandler
/**
* Implemented to comply with the AbstractHandler rqeuirements. Can not be called.
*/
public function write($message)
public function write($record)
{
throw new \LogicException('This method should not be called directly on the FingersCrossedHandler.');
}