Renaming method so they match those in Cache.

Removing method that was missed during previous refactor.
Updating tests.
This commit is contained in:
mark_story 2009-11-14 20:42:57 -05:00
parent fb483e9bff
commit be9f0ec4c7
2 changed files with 10 additions and 34 deletions

View file

@ -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.
@ -140,39 +131,24 @@ class CakeLog {
* @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.
* *

View file

@ -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);
} }
} }
@ -55,13 +55,13 @@ class CakeLogTest extends CakeTestCase {
'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();
} }
@ -93,7 +93,7 @@ class CakeLogTest extends CakeTestCase {
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');
} }
@ -108,7 +108,7 @@ class CakeLogTest extends CakeTestCase {
'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');