mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-05-28 02:13:31 +00:00
ensure that plain CakeLogInterface still works
This commit is contained in:
parent
8e8763d69d
commit
595cad84b3
3 changed files with 11 additions and 4 deletions
lib/Cake
|
@ -374,8 +374,12 @@ class CakeLog {
|
||||||
$scopes = array();
|
$scopes = array();
|
||||||
if ($logger instanceof BaseLog) {
|
if ($logger instanceof BaseLog) {
|
||||||
$config = $logger->config();
|
$config = $logger->config();
|
||||||
$types = $config['types'];
|
if (isset($config['types'])) {
|
||||||
$scopes = $config['scopes'];
|
$types = $config['types'];
|
||||||
|
}
|
||||||
|
if (isset($config['scopes'])) {
|
||||||
|
$scopes = $config['scopes'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (is_string($scope)) {
|
if (is_string($scope)) {
|
||||||
$inScope = in_array($scope, $scopes);
|
$inScope = in_array($scope, $scopes);
|
||||||
|
|
|
@ -64,6 +64,8 @@ class CakeLogTest extends CakeTestCase {
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
$this->assertEquals(CakeLog::configured(), array('libtest', 'plugintest'));
|
$this->assertEquals(CakeLog::configured(), array('libtest', 'plugintest'));
|
||||||
|
|
||||||
|
CakeLog::write(LOG_INFO, 'TestPluginLog is not a BaseLog descendant');
|
||||||
|
|
||||||
App::build();
|
App::build();
|
||||||
CakePlugin::unload();
|
CakePlugin::unload();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,10 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
App::uses('BaseLog', 'Log/Engine');
|
App::uses('CakeLogInterface', 'Log');
|
||||||
|
|
||||||
class TestPluginLog extends BaseLog {
|
class TestPluginLog implements CakeLogInterface
|
||||||
|
{
|
||||||
|
|
||||||
public function write($type, $message) {
|
public function write($type, $message) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue