alert example

// Ensure 'filter.settings' cacheability is respected.       CacheableMetadata::createFromRenderArray($element)
        ->addCacheableDependency($filter_settings)
        ->applyTo($element);
    }
    /** @var \Drupal\filter\Entity\FilterFormat $format **/
    $format = FilterFormat::load($format_id);
    // If the requested text format doesn't exist or its disabled, the text     // cannot be filtered.     if (!$format || !$format->status()) {
      $message = !$format ? 'Missing text format: %format.' : 'Disabled text format: %format.';
      static::logger('filter')->alert($message['%format' => $format_id]);
      $element['#markup'] = '';
      return $element;
    }

    $filter_must_be_applied = function DFilterInterface $filter) use ($filter_types_to_skip) {
      $enabled = $filter->status === TRUE;
      $type = $filter->getType();
      // Prevent FilterInterface::TYPE_HTML_RESTRICTOR from being skipped.       $filter_type_must_be_applied = $type == FilterInterface::TYPE_HTML_RESTRICTOR || !in_array($type$filter_types_to_skip);
      return $enabled && $filter_type_must_be_applied;
    };

    
$handler = new TestHandler();
        $processor = new DebugProcessor();
        $logger = new Logger(__METHOD__, [$handler][$processor]);

        $logger->debug('test message');
        $logger->info('test message');
        $logger->notice('test message');
        $logger->warning('test message');

        $logger->error('test message');
        $logger->critical('test message');
        $logger->alert('test message');
        $logger->emergency('test message');

        $this->assertSame(4, $logger->countErrors());
    }

    public function testGetLogsWithDebugProcessor2()
    {
        $handler = new TestHandler();
        $logger = new Logger('test', [$handler]);
        $logger->pushProcessor(new DebugProcessor());

        

  protected $logged = FALSE;

  /** * {@inheritdoc} */
  public function __construct(array $configuration$plugin_id$plugin_definition) {
    // Once per filter, log that a filter plugin was missing.     if (!$this->logged) {
      $this->logged = TRUE;
      \Drupal::logger('filter')->alert('Missing filter plugin: %filter.', ['%filter' => $plugin_id]);
    }
    parent::__construct($configuration$plugin_id$plugin_definition);
  }

  /** * {@inheritdoc} */
  public function process($text$langcode) {
    return new FilterProcessResult('');
  }

  
Home | Imprint | This part of the site doesn't use cookies.