3 namespace Drupal\system\Form;
5 use Drupal\Core\Form\ConfigFormBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Configure logging settings for this site.
11 class LoggingForm extends ConfigFormBase {
16 public function getFormId() {
17 return 'system_logging_settings';
23 protected function getEditableConfigNames() {
24 return ['system.logging'];
30 public function buildForm(array $form, FormStateInterface $form_state) {
31 $config = $this->config('system.logging');
32 $form['error_level'] = [
34 '#title' => t('Error messages to display'),
35 '#default_value' => $config->get('error_level'),
37 ERROR_REPORTING_HIDE => t('None'),
38 ERROR_REPORTING_DISPLAY_SOME => t('Errors and warnings'),
39 ERROR_REPORTING_DISPLAY_ALL => t('All messages'),
40 ERROR_REPORTING_DISPLAY_VERBOSE => t('All messages, with backtrace information'),
42 '#description' => t('It is recommended that sites running on production environments do not display any errors.'),
45 return parent::buildForm($form, $form_state);
51 public function submitForm(array &$form, FormStateInterface $form_state) {
52 $this->config('system.logging')
53 ->set('error_level', $form_state->getValue('error_level'))
56 parent::submitForm($form, $form_state);