1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 10:06:08 +02:00

Added docblocks and fixed a couple tests

This commit is contained in:
Jordi Boggiano
2011-02-22 12:10:54 +01:00
parent 81c6cd3ed1
commit 811e6c79d6
14 changed files with 79 additions and 15 deletions

View File

@@ -14,6 +14,13 @@ namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Formatter\LineFormatter;
/**
* Base Handler class providing the Handler structure
*
* Classes extending it should (in most cases) only implement write($message)
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
abstract class AbstractHandler implements HandlerInterface
{
protected $level;

View File

@@ -14,7 +14,7 @@ namespace Monolog\Handler;
use Monolog\Logger;
/**
* FingersCrossedHandler buffers all messages until a certain level is reached
* Buffers all messages 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
@@ -51,7 +51,7 @@ class FingersCrossedHandler extends AbstractHandler
* on, unless reset() is called, all messages are passed to the wrapped handler.
*
* @param array $message Message
* @return Boolean Whether the next handler in the stack should be called.
* @return Boolean Whether the message was handled
*/
public function handle($message)
{
@@ -73,7 +73,10 @@ class FingersCrossedHandler extends AbstractHandler
} else {
$this->handler->handle($message);
}
return false === $this->bubble;
if ($this->bubble && $this->parent) {
$this->parent->handle($originalMessage);
}
return true;
}
/**

View File

@@ -11,6 +11,11 @@
namespace Monolog\Handler;
/**
* Interface that all Monolog Handlers must implement
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
interface HandlerInterface
{
public function getHandler($message);

View File

@@ -13,14 +13,25 @@ namespace Monolog\Handler;
use Monolog\Logger;
/**
* Blackhole
*
* Any message it can handle will be thrown away. This can be used
* to put on top of an existing stack to override it temporarily.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class NullHandler extends AbstractHandler
{
public function handle($message)
{
if ($message['level'] < $this->level) {
return false;
return $this->parent ? $this->parent->handle($message) : false;
}
return false === $this->bubble;
if ($this->bubble && $this->parent) {
$this->parent->handle($originalMessage);
}
return true;
}
public function write($message)

View File

@@ -11,6 +11,11 @@
namespace Monolog\Handler;
/**
* Stores logs to files that are rotated every n day/week/month
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class RotatingFileHandler extends StreamHandler
{
protected $rotation;

View File

@@ -14,6 +14,13 @@ namespace Monolog\Handler;
use Monolog\Formatter\SimpleFormatter;
use Monolog\Logger;
/**
* Stores to any stream resource
*
* Can be used to store into php://stderr, remote and local files, etc.
*
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class StreamHandler extends AbstractHandler
{
protected $stream;

View File

@@ -14,7 +14,7 @@ namespace Monolog\Handler;
use Monolog\Logger;
/**
* TestHandler is used for testing purposes.
* Used for testing purposes.
*
* It records all messages and gives you access to them for verification.
*