You are here

public function EnsureSubscriber::onEnsure in Flysystem 8

Same name and namespace in other branches
  1. 3.x src/EventSubscriber/EnsureSubscriber.php \Drupal\flysystem\EventSubscriber\EnsureSubscriber::onEnsure()
  2. 2.0.x src/EventSubscriber/EnsureSubscriber.php \Drupal\flysystem\EventSubscriber\EnsureSubscriber::onEnsure()
  3. 3.0.x src/EventSubscriber/EnsureSubscriber.php \Drupal\flysystem\EventSubscriber\EnsureSubscriber::onEnsure()

Responds to FlysystemFactory::ensure().

File

src/EventSubscriber/EnsureSubscriber.php, line 48

Class

EnsureSubscriber
Event listener that listens to Flysystem ensure() calls.

Namespace

Drupal\flysystem\EventSubscriber

Code

public function onEnsure(EnsureEvent $event, $event_name, EventDispatcherInterface $dispatcher) {

  // We only want to log failures, since this runs frequently.
  switch ($event
    ->getSeverity()) {
    case RfcLogLevel::NOTICE:
    case RfcLogLevel::INFO:
      return;
  }
  $this->logger
    ->log($event
    ->getSeverity(), $event
    ->getMessage(), $event
    ->getContext());
}