You are here

function monolog_handler_info_load_all in Monolog 7

Same name and namespace in other branches
  1. 6 monolog.crud.inc \monolog_handler_info_load_all()

Loads all handler definitions from hook_monolog_handler_info() implementations.

Return value

array

Related topics

4 calls to monolog_handler_info_load_all()
monolog_get_profile_handlers in ./monolog.admin.inc
Returns the handlers associated with a profile.
monolog_handler_info_load in ./monolog.crud.inc
Returns a single handler definition by its unique name.
monolog_handler_page in ./monolog.admin.inc
Page callback; Lists the handlers than can be added.
monolog_profile_form in ./monolog.admin.inc
Form for adding and editing logging profile configurations.

File

./monolog.crud.inc, line 174
CRUD functions for logging profile configurations.

Code

function monolog_handler_info_load_all() {
  $handlers =& drupal_static(__FUNCTION__);
  if (!$handlers) {
    if (function_exists('composer_manager_register_autoloader')) {
      composer_manager_register_autoloader();
    }
    foreach (module_implements('monolog_handler_info') as $module) {
      $module_path = drupal_get_path('module', $module);
      $handler_path = module_invoke($module, 'monolog_handler_path');
      $hook = $module . '_monolog_handler_info';
      $info = (array) $hook();
      foreach ($info as $handler_name => $handler_info) {

        // Add the defaults to the handler info.
        $handlers[$handler_name] = $handler_info + array(
          'name' => $handler_name,
          'module' => $module,
          'handler file' => '',
          'loader callback' => 'monolog_' . $handler_name . '_handler_loader',
          'settings callback' => 'monolog_' . $handler_name . '_handler_settings',
        );

        // Set the path to the handler file if the module defines a handler
        // directory and the include has not yet been defined.
        if ($handler_path && !$handlers[$handler_name]['handler file']) {
          $handlers[$handler_name]['handler file'] = $module_path . '/' . $handler_path . '/' . $handler_name . '.inc';
        }
      }
    }
    drupal_alter('monolog_handler_info', $handlers);
  }
  return $handlers;
}