From 595cad84b3225a8aff4ed1bfbd24c9ecbf97d48c Mon Sep 17 00:00:00 2001 From: Rachman Chavik Date: Sun, 13 May 2012 15:53:42 +0700 Subject: [PATCH] ensure that plain CakeLogInterface still works --- lib/Cake/Log/CakeLog.php | 8 ++++++-- lib/Cake/Test/Case/Log/CakeLogTest.php | 2 ++ .../Plugin/TestPlugin/Lib/Log/Engine/TestPluginLog.php | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Log/CakeLog.php b/lib/Cake/Log/CakeLog.php index f62c3c3a1..7fd7511eb 100644 --- a/lib/Cake/Log/CakeLog.php +++ b/lib/Cake/Log/CakeLog.php @@ -374,8 +374,12 @@ class CakeLog { $scopes = array(); if ($logger instanceof BaseLog) { $config = $logger->config(); - $types = $config['types']; - $scopes = $config['scopes']; + if (isset($config['types'])) { + $types = $config['types']; + } + if (isset($config['scopes'])) { + $scopes = $config['scopes']; + } } if (is_string($scope)) { $inScope = in_array($scope, $scopes); diff --git a/lib/Cake/Test/Case/Log/CakeLogTest.php b/lib/Cake/Test/Case/Log/CakeLogTest.php index b552649c9..92eda8746 100644 --- a/lib/Cake/Test/Case/Log/CakeLogTest.php +++ b/lib/Cake/Test/Case/Log/CakeLogTest.php @@ -64,6 +64,8 @@ class CakeLogTest extends CakeTestCase { $this->assertTrue($result); $this->assertEquals(CakeLog::configured(), array('libtest', 'plugintest')); + CakeLog::write(LOG_INFO, 'TestPluginLog is not a BaseLog descendant'); + App::build(); CakePlugin::unload(); } diff --git a/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Log/Engine/TestPluginLog.php b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Log/Engine/TestPluginLog.php index 33ffaf4a1..753720d8d 100644 --- a/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Log/Engine/TestPluginLog.php +++ b/lib/Cake/Test/test_app/Plugin/TestPlugin/Lib/Log/Engine/TestPluginLog.php @@ -17,9 +17,10 @@ * @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) { }