1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 18:16:10 +02:00

#508 add hasLogger method to Monolog\Registry

This commit is contained in:
dtarasov
2015-02-18 11:56:56 +03:00
parent f05ed3a44a
commit ad5d65b262
2 changed files with 79 additions and 0 deletions

View File

@@ -63,6 +63,21 @@ class Registry
self::$loggers[$name] = $logger;
}
/**
* Checks if such logging channel exists by name or instance
*
* @param string|Logger $logger Name or logger instance
*/
public static function hasLogger($logger)
{
if ($logger instanceof Logger) {
$index = array_search($logger, self::$loggers, true);
return false !== $index;
} else {
return isset(self::$loggers[$logger]);
}
}
/**
* Removes instance from registry by name or instance
*