You are here

function _prod_check_error_reporting in Production check & Production monitor 7

Same name and namespace in other branches
  1. 6 prod_check.module \_prod_check_error_reporting()

File

./prod_check.module, line 674

Code

function _prod_check_error_reporting($caller = 'internal') {
  $check = array();
  $title = 'Logging and errors';
  $path = 'admin/config/development/logging';
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  $setting[ERROR_REPORTING_HIDE] = t('None');
  $setting[ERROR_REPORTING_DISPLAY_SOME] = t('Errors and warnings');
  $setting[ERROR_REPORTING_DISPLAY_ALL] = t('All messages');
  $current = variable_get('error_level', ERROR_REPORTING_DISPLAY_ALL);
  $check['prod_check_error_reporting'] = array(
    '#title' => t($title),
    '#state' => $current == ERROR_REPORTING_HIDE,
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_CRITICAL : PROD_CHECK_REQUIREMENT_ERROR,
    '#value_ok' => $setting[ERROR_REPORTING_HIDE],
    '#value_nok' => $setting[$current],
    '#description_ok' => prod_check_ok_title($title, $path),
    '#description_nok' => t('Your !link settings are set to %setting1, they should be set to %setting2 on a producion environment!', array(
      '!link' => '<em>' . l(t($title), $path, array(
        'attributes' => array(
          'title' => t($title),
        ),
        'query' => drupal_get_destination(),
      )) . '</em>',
      '%setting1' => $setting[$current],
      '%setting2' => $setting[ERROR_REPORTING_HIDE],
    )),
    '#nagios_key' => 'ERR',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}