unify engine to not require the suffix (as Cache and other places do).

This commit is contained in:
euromark 2013-06-21 15:04:27 +02:00
parent 0d486bdab4
commit cb24dbb084
5 changed files with 129 additions and 25 deletions

View file

@ -34,7 +34,7 @@ App::uses('LogEngineCollection', 'Log');
* A sample configuration would look like:
*
* {{{
* CakeLog::config('my_log', array('engine' => 'FileLog'));
* CakeLog::config('my_log', array('engine' => 'File'));
* }}}
*
* See the documentation on CakeLog::config() for more detail.
@ -133,7 +133,7 @@ class CakeLog {
*
* {{{
* CakeLog::config('second_file', array(
* 'engine' => 'FileLog',
* 'engine' => 'File',
* 'path' => '/var/logs/my_app/'
* ));
* }}}
@ -378,7 +378,7 @@ class CakeLog {
*/
protected static function _autoConfig() {
self::$_Collection->load('default', array(
'engine' => 'FileLog',
'engine' => 'File',
'path' => LOGS,
));
}

View file

@ -63,7 +63,9 @@ class LogEngineCollection extends ObjectCollection {
*/
protected static function _getLogger($loggerName) {
list($plugin, $loggerName) = pluginSplit($loggerName, true);
if (substr($loggerName, -3) !== 'Log') {
$loggerName .= 'Log';
}
App::uses($loggerName, $plugin . 'Log/Engine');
if (!class_exists($loggerName)) {
throw new CakeLogException(__d('cake_dev', 'Could not load class %s', $loggerName));