Skip to content

Commit

Permalink
Rename LogEngineCollection to LogEngineRegistry
Browse files Browse the repository at this point in the history
In preparation for converting the logging collection into the newer
style registry rename the internal property and collection class.
  • Loading branch information
markstory committed Aug 13, 2013
1 parent 4ef4182 commit 88f2f30
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions lib/Cake/Log/Log.php
Expand Up @@ -115,11 +115,11 @@
class Log {

/**
* LogEngineCollection class
* LogEngineRegistry class
*
* @var LogEngineCollection
* @var LogEngineRegistry
*/
protected static $_Collection;
protected static $_registry;

/**
* Log levels as detailed in RFC 5424
Expand Down Expand Up @@ -160,8 +160,8 @@ class Log {
* @return void
*/
protected static function _init() {
if (empty(static::$_Collection)) {
static::$_Collection = new LogEngineCollection();
if (empty(static::$_registry)) {
static::$_registry = new LogEngineRegistry();
static::_loadConfig();
}
}
Expand All @@ -175,7 +175,7 @@ protected static function _init() {
protected static function _loadConfig() {
$loggers = Configure::read('Log');
foreach ((array)$loggers as $key => $config) {
static::$_Collection->load($key, $config);
static::$_registry->load($key, $config);
}
}

Expand All @@ -189,7 +189,7 @@ protected static function _loadConfig() {
* @return void
*/
public static function reset() {
static::$_Collection = null;
static::$_registry = null;
}

/**
Expand All @@ -211,7 +211,7 @@ public static function config($key, $config) {
*/
public static function configured() {
static::_init();
return static::$_Collection->attached();
return static::$_registry->loaded();
}

/**
Expand All @@ -235,7 +235,7 @@ public static function levels() {
*/
public static function drop($streamName) {
static::_init();
static::$_Collection->unload($streamName);
static::$_registry->unload($streamName);
}

/**
Expand All @@ -247,10 +247,10 @@ public static function drop($streamName) {
*/
public static function enabled($streamName) {
static::_init();
if (!isset(static::$_Collection->{$streamName})) {
if (!isset(static::$_registry->{$streamName})) {
throw new Error\Exception(__d('cake_dev', 'Stream %s not found', $streamName));
}
return static::$_Collection->enabled($streamName);
return static::$_registry->enabled($streamName);
}

/**
Expand All @@ -263,10 +263,10 @@ public static function enabled($streamName) {
*/
public static function enable($streamName) {
static::_init();
if (!isset(static::$_Collection->{$streamName})) {
if (!isset(static::$_registry->{$streamName})) {
throw new Error\Exception(__d('cake_dev', 'Stream %s not found', $streamName));
}
static::$_Collection->enable($streamName);
static::$_registry->enable($streamName);
}

/**
Expand All @@ -280,10 +280,10 @@ public static function enable($streamName) {
*/
public static function disable($streamName) {
static::_init();
if (!isset(static::$_Collection->{$streamName})) {
if (!isset(static::$_registry->{$streamName})) {
throw new Error\Exception(__d('cake_dev', 'Stream %s not found', $streamName));
}
static::$_Collection->disable($streamName);
static::$_registry->disable($streamName);
}

/**
Expand All @@ -297,11 +297,11 @@ public static function disable($streamName) {
public static function engine($name, $engine = null) {
static::_init();
if ($engine) {
static::$_Collection->load($name, $engine);
static::$_registry->load($name, $engine);
return;
}
if (static::$_Collection->{$name}) {
return static::$_Collection->{$name};
if (static::$_registry->{$name}) {
return static::$_registry->{$name};
}
return false;
}
Expand Down Expand Up @@ -358,8 +358,8 @@ public static function write($level, $message, $scope = array()) {
$level = static::$_levels[$level];
}
$logged = false;
foreach (static::$_Collection->enabled() as $streamName) {
$logger = static::$_Collection->{$streamName};
foreach (static::$_registry->enabled() as $streamName) {
$logger = static::$_registry->{$streamName};
$levels = $scopes = null;
if ($logger instanceof BaseLog) {
$levels = $logger->levels();
Expand Down
Expand Up @@ -24,7 +24,7 @@
*
* @package Cake.Log
*/
class LogEngineCollection extends ObjectCollection {
class LogEngineRegistry extends ObjectCollection {

/**
* Loads/constructs a Log engine.
Expand Down

0 comments on commit 88f2f30

Please sign in to comment.