Skip to content

Commit

Permalink
Renaming method so they match those in Cache.
Browse files Browse the repository at this point in the history
Removing method that was missed during previous refactor.
Updating tests.
  • Loading branch information
markstory committed Nov 15, 2009
1 parent fb483e9 commit be9f0ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 34 deletions.
32 changes: 4 additions & 28 deletions cake/libs/cake_log.php
Expand Up @@ -19,15 +19,6 @@
* @since CakePHP(tm) v 0.2.9 * @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */

/**
* Included libraries.
*
*/
if (!class_exists('File')) {
require LIBS . 'file.php';
}

/** /**
* Set up error level constants to be used within the framework if they are not defined within the * Set up error level constants to be used within the framework if they are not defined within the
* system. * system.
Expand Down Expand Up @@ -140,39 +131,24 @@ function _getLogger($loggerName) {
* @return array * @return array
* @static * @static
*/ */
function streams() { function configured() {
$self = CakeLog::getInstance(); $self = CakeLog::getInstance();
return array_keys($self->_streams); return array_keys($self->_streams);
} }


/** /**
* Remove a stream from the active streams. Once a stream has been removed * Removes a stream from the active streams. Once a stream has been removed
* it will no longer be called. * it will no longer have messages sent to it.
* *
* @param string $keyname Key name of callable to remove. * @param string $keyname Key name of callable to remove.
* @return void * @return void
* @static * @static
*/ */
function remove($streamName) { function drop($streamName) {
$self = CakeLog::getInstance(); $self = CakeLog::getInstance();
unset($self->_streams[$streamName]); unset($self->_streams[$streamName]);
} }


/**
* Add a stream the logger.
* Streams represent destinations for log messages. Each stream can connect to
* a different resource /interface and capture/write output to that source.
*
* @param string $key Keyname of config.
* @param array $config Array of config information for the LogStream
* @return boolean success
* @static
*/
function addStream($key, $config) {
$self = CakeLog::getInstance();
$self->_streams[$key] = $config;
}

/** /**
* Configures the automatic/default stream a FileLog. * Configures the automatic/default stream a FileLog.
* *
Expand Down
12 changes: 6 additions & 6 deletions cake/tests/cases/libs/cake_log.test.php
Expand Up @@ -34,9 +34,9 @@ class CakeLogTest extends CakeTestCase {
* @return void * @return void
*/ */
function startTest() { function startTest() {
$streams = CakeLog::streams(); $streams = CakeLog::configured();
foreach ($streams as $stream) { foreach ($streams as $stream) {
CakeLog::remove($stream); CakeLog::drop($stream);
} }
} }


Expand All @@ -55,13 +55,13 @@ function testImportingLoggers() {
'engine' => 'TestAppLog' 'engine' => 'TestAppLog'
)); ));
$this->assertTrue($result); $this->assertTrue($result);
$this->assertEqual(CakeLog::streams(), array('libtest')); $this->assertEqual(CakeLog::configured(), array('libtest'));


$result = CakeLog::config('plugintest', array( $result = CakeLog::config('plugintest', array(
'engine' => 'TestPlugin.TestPluginLog' 'engine' => 'TestPlugin.TestPluginLog'
)); ));
$this->assertTrue($result); $this->assertTrue($result);
$this->assertEqual(CakeLog::streams(), array('libtest', 'plugintest')); $this->assertEqual(CakeLog::configured(), array('libtest', 'plugintest'));


App::build(); App::build();
} }
Expand Down Expand Up @@ -93,7 +93,7 @@ function testAutoConfig() {
CakeLog::write(LOG_WARNING, 'Test warning'); CakeLog::write(LOG_WARNING, 'Test warning');
$this->assertTrue(file_exists(LOGS . 'error.log')); $this->assertTrue(file_exists(LOGS . 'error.log'));


$result = CakeLog::streams(); $result = CakeLog::configured();
$this->assertEqual($result, array('default')); $this->assertEqual($result, array('default'));
unlink(LOGS . 'error.log'); unlink(LOGS . 'error.log');
} }
Expand All @@ -108,7 +108,7 @@ function testConfig() {
'engine' => 'FileLog', 'engine' => 'FileLog',
'path' => LOGS 'path' => LOGS
)); ));
$result = CakeLog::streams(); $result = CakeLog::configured();
$this->assertEqual($result, array('file')); $this->assertEqual($result, array('file'));


@unlink(LOGS . 'error.log'); @unlink(LOGS . 'error.log');
Expand Down

0 comments on commit be9f0ec

Please sign in to comment.