You are here

public function CronJob::startLog in Ultimate Cron 8.2

Start logging.

Parameters

string $lock_id: The lock id to use.

string $init_message: Initial message for the log.

Return value

\Drupal\ultimate_cron\Logger\LogEntry The log object.

Overrides CronJobInterface::startLog

2 calls to CronJob::startLog()
CronJob::postSave in src/Entity/CronJob.php
Acts on a saved entity before the insert or update hook is invoked.
CronJob::run in src/Entity/CronJob.php
Run job.

File

src/Entity/CronJob.php, line 565

Class

CronJob
Class for handling cron jobs.

Namespace

Drupal\ultimate_cron\Entity

Code

public function startLog($lock_id, $init_message = '', $log_type = ULTIMATE_CRON_LOG_TYPE_NORMAL) {
  $logger = $this
    ->getPlugin('logger');
  $log_entry = $logger
    ->createEntry($this
    ->id(), $lock_id, $init_message, $log_type);
  \Drupal::service('logger.ultimate_cron')
    ->catchMessages($log_entry);
  return $log_entry;
}