mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 13:16:39 +02:00
Merge branch '1.x'
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
|
### 1.20.0 (2016-07-02)
|
||||||
|
|
||||||
|
* Added FingersCrossedHandler::activate() to manually trigger the handler regardless of the activation policy
|
||||||
|
* Added StreamHandler::getUrl to retrieve the stream's URL
|
||||||
|
* Added ability to override addRow/addTitle in HtmlFormatter
|
||||||
|
* Added the $context to context information when the ErrorHandler handles a regular php error
|
||||||
|
* Deprecated RotatingFileHandler::setFilenameFormat to only support 3 formats: Y, Y-m and Y-m-d
|
||||||
|
* Fixed WhatFailureGroupHandler to work with PHP7 throwables
|
||||||
|
* Fixed a few minor bugs
|
||||||
|
|
||||||
### 1.19.0 (2016-04-12)
|
### 1.19.0 (2016-04-12)
|
||||||
|
|
||||||
* Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed
|
* Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed
|
||||||
|
@@ -164,7 +164,7 @@ class ErrorHandler
|
|||||||
// fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries
|
// fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries
|
||||||
if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) {
|
if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) {
|
||||||
$level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL;
|
$level = isset($this->errorLevelMap[$code]) ? $this->errorLevelMap[$code] : LogLevel::CRITICAL;
|
||||||
$this->logger->log($level, self::codeToString($code).': '.$message, ['code' => $code, 'message' => $message, 'file' => $file, 'line' => $line]);
|
$this->logger->log($level, self::codeToString($code).': '.$message, ['code' => $code, 'message' => $message, 'file' => $file, 'line' => $line, 'context' => $context]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->previousErrorHandler === true) {
|
if ($this->previousErrorHandler === true) {
|
||||||
|
@@ -52,7 +52,7 @@ class HtmlFormatter extends NormalizerFormatter
|
|||||||
* @param bool $escapeTd false if td content must not be html escaped
|
* @param bool $escapeTd false if td content must not be html escaped
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function addRow($th, $td = ' ', $escapeTd = true)
|
protected function addRow($th, $td = ' ', $escapeTd = true)
|
||||||
{
|
{
|
||||||
$th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8');
|
$th = htmlspecialchars($th, ENT_NOQUOTES, 'UTF-8');
|
||||||
if ($escapeTd) {
|
if ($escapeTd) {
|
||||||
@@ -69,7 +69,7 @@ class HtmlFormatter extends NormalizerFormatter
|
|||||||
* @param int $level Error level
|
* @param int $level Error level
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function addTitle($title, $level)
|
protected function addTitle($title, $level)
|
||||||
{
|
{
|
||||||
$title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8');
|
$title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8');
|
||||||
|
|
||||||
|
@@ -75,6 +75,16 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface
|
|||||||
*/
|
*/
|
||||||
public function handleBatch(array $records)
|
public function handleBatch(array $records)
|
||||||
{
|
{
|
||||||
|
if ($this->processors) {
|
||||||
|
$processed = array();
|
||||||
|
foreach ($records as $record) {
|
||||||
|
foreach ($this->processors as $processor) {
|
||||||
|
$processed[] = call_user_func($processor, $record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$records = $processed;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->handlers as $handler) {
|
foreach ($this->handlers as $handler) {
|
||||||
$handler->handleBatch($records);
|
$handler->handleBatch($records);
|
||||||
}
|
}
|
||||||
|
@@ -86,4 +86,27 @@ class GroupHandlerTest extends TestCase
|
|||||||
$records = $test->getRecords();
|
$records = $test->getRecords();
|
||||||
$this->assertTrue($records[0]['extra']['foo']);
|
$this->assertTrue($records[0]['extra']['foo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Monolog\Handler\GroupHandler::handle
|
||||||
|
*/
|
||||||
|
public function testHandleBatchUsesProcessors()
|
||||||
|
{
|
||||||
|
$testHandlers = array(new TestHandler(), new TestHandler());
|
||||||
|
$handler = new GroupHandler($testHandlers);
|
||||||
|
$handler->pushProcessor(function ($record) {
|
||||||
|
$record['extra']['foo'] = true;
|
||||||
|
|
||||||
|
return $record;
|
||||||
|
});
|
||||||
|
$handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)));
|
||||||
|
foreach ($testHandlers as $test) {
|
||||||
|
$this->assertTrue($test->hasDebugRecords());
|
||||||
|
$this->assertTrue($test->hasInfoRecords());
|
||||||
|
$this->assertTrue(count($test->getRecords()) === 2);
|
||||||
|
$records = $test->getRecords();
|
||||||
|
$this->assertTrue($records[0]['extra']['foo']);
|
||||||
|
$this->assertTrue($records[1]['extra']['foo']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user