You are here

public function WatchdogLogger::log in Ultimate Cron 8.2

Overrides RfcLoggerTrait::log

File

src/Logger/WatchdogLogger.php, line 52

Class

WatchdogLogger
Logs events in currently running cronjobs.

Namespace

Drupal\ultimate_cron\Logger

Code

public function log($level, $message, array $context = array()) {
  if ($this->logEntries) {

    // Remove any backtraces since they may contain an unserializable variable.
    unset($context['backtrace']);

    // Convert PSR3-style messages to
    // \Drupal\Component\Render\FormattableMarkup style, so they can be
    // translated too in runtime.
    $message_placeholders = $this->parser
      ->parseMessagePlaceholders($message, $context);
    foreach ($this->logEntries as $log_entry) {
      $log_entry
        ->log($message, $message_placeholders, $level);
    }
  }
}