MDL-42891 logging: Add support for getting readers that implement a specific interface in log manager

This commit is contained in:
Ankit Agarwal 2014-02-21 13:15:46 +08:00 committed by Petr Škoda
parent 8bae0d0d80
commit e083efe0ac
2 changed files with 9 additions and 3 deletions

View File

@ -95,14 +95,18 @@ class manager implements \core\log\manager {
*
* This way the reports find out available sources of data.
*
* @param string $interface Returned stores must implement this interface.
*
* @return \core\log\reader[] list of available log data readers
*/
public function get_readers() {
public function get_readers($interface = null) {
$this->init();
$return = array();
foreach ($this->readers as $plugin => $reader) {
if (empty($interface) || ($reader instanceof $interface)) {
$return[$plugin] = $reader;
}
}
return $return;
}

View File

@ -38,9 +38,11 @@ interface manager {
/**
* Return list of available log readers.
*
* @param string $interface All returned readers must implement this interface.
*
* @return \core\log\reader[]
*/
public function get_readers();
public function get_readers($interface = null);
/**
* Dispose all initialised stores.