Browse Source

Revert changes in dispatcher 18841 (#18843)

tags/2.0.44
Bizley 3 years ago committed by GitHub
parent
commit
44388e2cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      framework/CHANGELOG.md
  2. 9
      framework/log/Dispatcher.php
  3. 11
      tests/framework/log/DispatcherTest.php

1
framework/CHANGELOG.md

@ -8,7 +8,6 @@ Yii Framework 2 Change Log
- Enh #18826: Add ability to turn the sorting off for a clicked column in GridView with multisort (ditibal)
- Bug #18646: Remove stale identity data from session if `IdentityInterface::findIdentity()` returns `null` (mikehaertl)
- Bug #18832: Fix `Inflector::camel2words()` adding extra spaces (brandonkelly)
- Bug #18840: Fix `yii2/log/Logger` to set logger globally (lexizz)
2.0.43 August 09, 2021

9
framework/log/Dispatcher.php

@ -10,7 +10,6 @@ namespace yii\log;
use Yii;
use yii\base\Component;
use yii\base\ErrorHandler;
use yii\base\InvalidConfigException;
/**
* Dispatcher manages a set of [[Target|log targets]].
@ -107,8 +106,8 @@ class Dispatcher extends Component
/**
* Gets the connected logger.
* If not set, [[\Yii::getLogger()]] will be used.
* @property Logger the logger. If not set, [[\Yii::getLogger()]] will be used.
* If not set, [[Yii::getLogger()]] will be used.
* @property Logger the logger. If not set, [[Yii::getLogger()]] will be used.
* @return Logger the logger.
*/
public function getLogger()
@ -124,7 +123,8 @@ class Dispatcher extends Component
* Sets the connected logger.
* @param Logger|string|array $value the logger to be used. This can either be a logger instance
* or a configuration that will be used to create one using [[Yii::createObject()]].
* @throws InvalidConfigException
* If you are providing custom logger configuration and would like it to be used for the whole application
* and not just for the dispatcher you should use [[Yii::setLogger()]] instead.
*/
public function setLogger($value)
{
@ -133,7 +133,6 @@ class Dispatcher extends Component
}
$this->_logger = $value;
Yii::setLogger($value);
$this->_logger->dispatcher = $this;
}

11
tests/framework/log/DispatcherTest.php

@ -18,7 +18,6 @@ namespace yii\log {
namespace yiiunit\framework\log {
use yii\BaseYii;
use yiiunit\framework\log\mocks\TargetMock;
use Yii;
use yii\base\UserException;
@ -88,16 +87,6 @@ namespace yiiunit\framework\log {
]);
$this->assertInstanceOf('yii\log\Logger', $dispatcher->getLogger());
$this->assertEquals(42, $dispatcher->getLogger()->traceLevel);
$dispatcher = new Dispatcher([
'logger' => [
'class' => 'yii\log\Logger',
'profilingAware' => true,
],
]);
$this->assertInstanceOf('yii\log\Logger', $dispatcher->getLogger());
$this->assertEquals(true, $dispatcher->getLogger()->profilingAware);
$this->assertEquals(true, BaseYii::getLogger()->profilingAware);
}
/**

Loading…
Cancel
Save