update 1.0.8.0
Commits for version update
This commit is contained in:
24
vendor/psr/log/Psr/Log/AbstractLogger.php
vendored
24
vendor/psr/log/Psr/Log/AbstractLogger.php
vendored
@@ -15,7 +15,8 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* System is unusable.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function emergency($message, array $context = array())
|
||||
@@ -30,7 +31,8 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* trigger the SMS alerts and wake you up.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function alert($message, array $context = array())
|
||||
@@ -44,7 +46,8 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* Example: Application component unavailable, unexpected exception.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function critical($message, array $context = array())
|
||||
@@ -57,7 +60,8 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* be logged and monitored.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function error($message, array $context = array())
|
||||
@@ -72,7 +76,8 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* that are not necessarily wrong.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function warning($message, array $context = array())
|
||||
@@ -84,7 +89,8 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* Normal but significant events.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function notice($message, array $context = array())
|
||||
@@ -98,7 +104,8 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* Example: User logs in, SQL logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function info($message, array $context = array())
|
||||
@@ -110,7 +117,8 @@ abstract class AbstractLogger implements LoggerInterface
|
||||
* Detailed debug information.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function debug($message, array $context = array())
|
||||
|
||||
16
vendor/psr/log/Psr/Log/LogLevel.php
vendored
16
vendor/psr/log/Psr/Log/LogLevel.php
vendored
@@ -3,16 +3,16 @@
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* Describes log levels
|
||||
* Describes log levels.
|
||||
*/
|
||||
class LogLevel
|
||||
{
|
||||
const EMERGENCY = 'emergency';
|
||||
const ALERT = 'alert';
|
||||
const CRITICAL = 'critical';
|
||||
const ERROR = 'error';
|
||||
const WARNING = 'warning';
|
||||
const NOTICE = 'notice';
|
||||
const INFO = 'info';
|
||||
const DEBUG = 'debug';
|
||||
const ALERT = 'alert';
|
||||
const CRITICAL = 'critical';
|
||||
const ERROR = 'error';
|
||||
const WARNING = 'warning';
|
||||
const NOTICE = 'notice';
|
||||
const INFO = 'info';
|
||||
const DEBUG = 'debug';
|
||||
}
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* Describes a logger-aware instance
|
||||
* Describes a logger-aware instance.
|
||||
*/
|
||||
interface LoggerAwareInterface
|
||||
{
|
||||
/**
|
||||
* Sets a logger instance on the object
|
||||
* Sets a logger instance on the object.
|
||||
*
|
||||
* @param LoggerInterface $logger
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function setLogger(LoggerInterface $logger);
|
||||
|
||||
8
vendor/psr/log/Psr/Log/LoggerAwareTrait.php
vendored
8
vendor/psr/log/Psr/Log/LoggerAwareTrait.php
vendored
@@ -7,12 +7,16 @@ namespace Psr\Log;
|
||||
*/
|
||||
trait LoggerAwareTrait
|
||||
{
|
||||
/** @var LoggerInterface */
|
||||
/**
|
||||
* The logger instance.
|
||||
*
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Sets a logger.
|
||||
*
|
||||
*
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function setLogger(LoggerInterface $logger)
|
||||
|
||||
33
vendor/psr/log/Psr/Log/LoggerInterface.php
vendored
33
vendor/psr/log/Psr/Log/LoggerInterface.php
vendored
@@ -3,14 +3,14 @@
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* Describes a logger instance
|
||||
* Describes a logger instance.
|
||||
*
|
||||
* The message MUST be a string or object implementing __toString().
|
||||
*
|
||||
* The message MAY contain placeholders in the form: {foo} where foo
|
||||
* will be replaced by the context data in key "foo".
|
||||
*
|
||||
* The context array can contain arbitrary data, the only assumption that
|
||||
* The context array can contain arbitrary data. The only assumption that
|
||||
* can be made by implementors is that if an Exception instance is given
|
||||
* to produce a stack trace, it MUST be in a key named "exception".
|
||||
*
|
||||
@@ -23,7 +23,8 @@ interface LoggerInterface
|
||||
* System is unusable.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function emergency($message, array $context = array());
|
||||
@@ -35,7 +36,8 @@ interface LoggerInterface
|
||||
* trigger the SMS alerts and wake you up.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function alert($message, array $context = array());
|
||||
@@ -46,7 +48,8 @@ interface LoggerInterface
|
||||
* Example: Application component unavailable, unexpected exception.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function critical($message, array $context = array());
|
||||
@@ -56,7 +59,8 @@ interface LoggerInterface
|
||||
* be logged and monitored.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function error($message, array $context = array());
|
||||
@@ -68,7 +72,8 @@ interface LoggerInterface
|
||||
* that are not necessarily wrong.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function warning($message, array $context = array());
|
||||
@@ -77,7 +82,8 @@ interface LoggerInterface
|
||||
* Normal but significant events.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function notice($message, array $context = array());
|
||||
@@ -88,7 +94,8 @@ interface LoggerInterface
|
||||
* Example: User logs in, SQL logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function info($message, array $context = array());
|
||||
@@ -97,7 +104,8 @@ interface LoggerInterface
|
||||
* Detailed debug information.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function debug($message, array $context = array());
|
||||
@@ -105,9 +113,10 @@ interface LoggerInterface
|
||||
/**
|
||||
* Logs with an arbitrary level.
|
||||
*
|
||||
* @param mixed $level
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function log($level, $message, array $context = array());
|
||||
|
||||
33
vendor/psr/log/Psr/Log/LoggerTrait.php
vendored
33
vendor/psr/log/Psr/Log/LoggerTrait.php
vendored
@@ -6,8 +6,8 @@ namespace Psr\Log;
|
||||
* This is a simple Logger trait that classes unable to extend AbstractLogger
|
||||
* (because they extend another class, etc) can include.
|
||||
*
|
||||
* It simply delegates all log-level-specific methods to the `log` method to
|
||||
* reduce boilerplate code that a simple Logger that does the same thing with
|
||||
* It simply delegates all log-level-specific methods to the `log` method to
|
||||
* reduce boilerplate code that a simple Logger that does the same thing with
|
||||
* messages regardless of the error level has to implement.
|
||||
*/
|
||||
trait LoggerTrait
|
||||
@@ -16,7 +16,8 @@ trait LoggerTrait
|
||||
* System is unusable.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function emergency($message, array $context = array())
|
||||
@@ -31,7 +32,8 @@ trait LoggerTrait
|
||||
* trigger the SMS alerts and wake you up.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function alert($message, array $context = array())
|
||||
@@ -45,7 +47,8 @@ trait LoggerTrait
|
||||
* Example: Application component unavailable, unexpected exception.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function critical($message, array $context = array())
|
||||
@@ -58,7 +61,8 @@ trait LoggerTrait
|
||||
* be logged and monitored.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function error($message, array $context = array())
|
||||
@@ -73,7 +77,8 @@ trait LoggerTrait
|
||||
* that are not necessarily wrong.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function warning($message, array $context = array())
|
||||
@@ -85,7 +90,8 @@ trait LoggerTrait
|
||||
* Normal but significant events.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function notice($message, array $context = array())
|
||||
@@ -99,7 +105,8 @@ trait LoggerTrait
|
||||
* Example: User logs in, SQL logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function info($message, array $context = array())
|
||||
@@ -111,7 +118,8 @@ trait LoggerTrait
|
||||
* Detailed debug information.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function debug($message, array $context = array())
|
||||
@@ -122,9 +130,10 @@ trait LoggerTrait
|
||||
/**
|
||||
* Logs with an arbitrary level.
|
||||
*
|
||||
* @param mixed $level
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
abstract public function log($level, $message, array $context = array());
|
||||
|
||||
7
vendor/psr/log/Psr/Log/NullLogger.php
vendored
7
vendor/psr/log/Psr/Log/NullLogger.php
vendored
@@ -3,7 +3,7 @@
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* This Logger can be used to avoid conditional log calls
|
||||
* This Logger can be used to avoid conditional log calls.
|
||||
*
|
||||
* Logging should always be optional, and if no logger is provided to your
|
||||
* library creating a NullLogger instance to have something to throw logs at
|
||||
@@ -15,9 +15,10 @@ class NullLogger extends AbstractLogger
|
||||
/**
|
||||
* Logs with an arbitrary level.
|
||||
*
|
||||
* @param mixed $level
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @param array $context
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function log($level, $message, array $context = array())
|
||||
|
||||
@@ -2,28 +2,32 @@
|
||||
|
||||
namespace Psr\Log\Test;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\LogLevel;
|
||||
|
||||
/**
|
||||
* Provides a base test class for ensuring compliance with the LoggerInterface
|
||||
* Provides a base test class for ensuring compliance with the LoggerInterface.
|
||||
*
|
||||
* Implementors can extend the class and implement abstract methods to run this as part of their test suite
|
||||
* Implementors can extend the class and implement abstract methods to run this
|
||||
* as part of their test suite.
|
||||
*/
|
||||
abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @return LoggerInterface
|
||||
*/
|
||||
abstract function getLogger();
|
||||
abstract public function getLogger();
|
||||
|
||||
/**
|
||||
* This must return the log messages in order with a simple formatting: "<LOG LEVEL> <MESSAGE>"
|
||||
* This must return the log messages in order.
|
||||
*
|
||||
* Example ->error('Foo') would yield "error Foo"
|
||||
* The simple formatting of the messages is: "<LOG LEVEL> <MESSAGE>".
|
||||
*
|
||||
* Example ->error('Foo') would yield "error Foo".
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
abstract function getLogs();
|
||||
abstract public function getLogs();
|
||||
|
||||
public function testImplements()
|
||||
{
|
||||
@@ -61,7 +65,7 @@ abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Psr\Log\InvalidArgumentException
|
||||
* @expectedException \Psr\Log\InvalidArgumentException
|
||||
*/
|
||||
public function testThrowsOnInvalidLevel()
|
||||
{
|
||||
@@ -80,12 +84,19 @@ abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testObjectCastToString()
|
||||
{
|
||||
$dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
|
||||
if (method_exists($this, 'createMock')) {
|
||||
$dummy = $this->createMock('Psr\Log\Test\DummyTest', array('__toString'));
|
||||
} else {
|
||||
$dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
|
||||
}
|
||||
$dummy->expects($this->once())
|
||||
->method('__toString')
|
||||
->will($this->returnValue('DUMMY'));
|
||||
|
||||
$this->getLogger()->warning($dummy);
|
||||
|
||||
$expected = array('warning DUMMY');
|
||||
$this->assertEquals($expected, $this->getLogs());
|
||||
}
|
||||
|
||||
public function testContextCanContainAnything()
|
||||
@@ -102,15 +113,28 @@ abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$this->getLogger()->warning('Crazy context data', $context);
|
||||
|
||||
$expected = array('warning Crazy context data');
|
||||
$this->assertEquals($expected, $this->getLogs());
|
||||
}
|
||||
|
||||
public function testContextExceptionKeyCanBeExceptionOrOtherValues()
|
||||
{
|
||||
$this->getLogger()->warning('Random message', array('exception' => 'oops'));
|
||||
$this->getLogger()->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
|
||||
$logger = $this->getLogger();
|
||||
$logger->warning('Random message', array('exception' => 'oops'));
|
||||
$logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
|
||||
|
||||
$expected = array(
|
||||
'warning Random message',
|
||||
'critical Uncaught Exception!'
|
||||
);
|
||||
$this->assertEquals($expected, $this->getLogs());
|
||||
}
|
||||
}
|
||||
|
||||
class DummyTest
|
||||
{
|
||||
}
|
||||
public function __toString()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user