mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Fixes #16565: Added missing parts of the context message in \yii\log\Target::collect
This commit is contained in:
committed by
Alexander Makarov
parent
53e6c321d4
commit
3275f97684
@ -9,8 +9,9 @@ Yii Framework 2 Change Log
|
|||||||
- Enh #17345: Improved performance of `yii\db\Connection::quoteColumnName()` (brandonkelly)
|
- Enh #17345: Improved performance of `yii\db\Connection::quoteColumnName()` (brandonkelly)
|
||||||
- Enh #17348: Improved performance of `yii\db\Connection::quoteTableName()` (brandonkelly)
|
- Enh #17348: Improved performance of `yii\db\Connection::quoteTableName()` (brandonkelly)
|
||||||
- Enh #17353: Added `sameSite` support for `yii\web\Cookie` and `yii\web\Session::cookieParams` (rhertogh)
|
- Enh #17353: Added `sameSite` support for `yii\web\Cookie` and `yii\web\Session::cookieParams` (rhertogh)
|
||||||
- Bug #17341: Allow callable objects to be set to `\yii\filters\AccessRule::$roleParams` (alexkart)
|
- Bug #17341: Allowed callable objects to be set to `\yii\filters\AccessRule::$roleParams` (alexkart)
|
||||||
- Bug #17070: Strip invalid character from fallback file name (alexkart)
|
- Bug #17070: Striped invalid character from fallback file name in `Content-Disposition` header when using `\yii\web\Response::sendFile` (alexkart)
|
||||||
|
- Bug #16565: Added missing parts of the context message in `\yii\log\Target::collect` (alexkart)
|
||||||
|
|
||||||
|
|
||||||
2.0.20 June 04, 2019
|
2.0.20 June 04, 2019
|
||||||
|
|||||||
@ -150,7 +150,7 @@ abstract class Target extends Component
|
|||||||
$count = count($this->messages);
|
$count = count($this->messages);
|
||||||
if ($count > 0 && ($final || $this->exportInterval > 0 && $count >= $this->exportInterval)) {
|
if ($count > 0 && ($final || $this->exportInterval > 0 && $count >= $this->exportInterval)) {
|
||||||
if (($context = $this->getContextMessage()) !== '') {
|
if (($context = $this->getContextMessage()) !== '') {
|
||||||
$this->messages[] = [$context, Logger::LEVEL_INFO, 'application', YII_BEGIN_TIME];
|
$this->messages[] = [$context, Logger::LEVEL_INFO, 'application', YII_BEGIN_TIME, [], 0];
|
||||||
}
|
}
|
||||||
// set exportInterval to 0 to avoid triggering export again while exporting
|
// set exportInterval to 0 to avoid triggering export again while exporting
|
||||||
$oldExportInterval = $this->exportInterval;
|
$oldExportInterval = $this->exportInterval;
|
||||||
|
|||||||
@ -220,6 +220,22 @@ class TargetTest extends TestCase
|
|||||||
$formatted = $target->formatMessage([$text, $level, $category, $timestamp]);
|
$formatted = $target->formatMessage([$text, $level, $category, $timestamp]);
|
||||||
$this->assertSame($expectedWithMicro, $formatted);
|
$this->assertSame($expectedWithMicro, $formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCollectMessageStructure()
|
||||||
|
{
|
||||||
|
$target = new TestTarget(['logVars' => ['_SERVER']]);
|
||||||
|
static::$messages = [];
|
||||||
|
|
||||||
|
$messages = [
|
||||||
|
['test', 1, 'application', 1560428356.212978, [], 1888416]
|
||||||
|
];
|
||||||
|
|
||||||
|
$target->collect($messages, false);
|
||||||
|
|
||||||
|
$this->assertCount(2, static::$messages);
|
||||||
|
$this->assertCount(6, static::$messages[0]);
|
||||||
|
$this->assertCount(6, static::$messages[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestTarget extends Target
|
class TestTarget extends Target
|
||||||
|
|||||||
Reference in New Issue
Block a user