Skip to content

Commit

Permalink
ensure that plain CakeLogInterface still works
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavik committed May 13, 2012
1 parent 8e8763d commit 595cad8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/Cake/Log/CakeLog.php
Expand Up @@ -374,8 +374,12 @@ public static function write($type, $message, $scope = array()) {
$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);
Expand Down
2 changes: 2 additions & 0 deletions lib/Cake/Test/Case/Log/CakeLogTest.php
Expand Up @@ -64,6 +64,8 @@ public function testImportingLoggers() {
$this->assertTrue($result);
$this->assertEquals(CakeLog::configured(), array('libtest', 'plugintest'));

CakeLog::write(LOG_INFO, 'TestPluginLog is not a BaseLog descendant');

App::build();
CakePlugin::unload();
}
Expand Down
Expand Up @@ -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) {
}
Expand Down

0 comments on commit 595cad8

Please sign in to comment.