You are here

public function LogsHttpLogger::log in Logs HTTP 8

Overrides RfcLoggerTrait::log

File

src/Logger/LogsHttpLogger.php, line 68

Class

LogsHttpLogger
Implements a Logs Http Logger instance.

Namespace

Drupal\logs_http\Logger

Code

public function log($level, $message, array $context = []) {
  if (!$this
    ->isEnabled()) {

    // Service is disabled.
    return;
  }
  if ($level > $this->config
    ->get('severity_level')) {

    // Severity level is above the ones we want to log.
    return;
  }
  $event = $this
    ->registerEvent($level, $message, $context);
  if (!$event) {

    // No event created.
    return;
  }
  $this
    ->addEventToCache($event);
}