/** * @param int|string $key * @param mixed $value */ protected function showIterationMessage($key, $value) { if ($this->message) { $context = ['key' => $key, 'value' => $value]; $context += $this->context; $context += TaskInfo::getTaskContext($this); $this->printTaskInfo($this->message, $context); } }
/** * Return a context useful for logging messages. * * @return array */ public function getContext() { $task = $this->getTask(); return TaskInfo::getTaskContext($task) + ['code' => $this->getExitCode(), 'data' => $this->getArrayCopy(), 'time' => $this->getExecutionTime(), 'message' => $this->getMessage()]; }
/** * {@inheritdoc} */ public function progressMessage($text, $context = [], $level = LogLevel::NOTICE) { $context += ['name' => 'Progress']; $context += TaskInfo::getTaskContext($this); return $this->addCode(function () use($level, $text, $context) { $this->printTaskOutput($level, $text, $context); }); }
/** * @param null|array $context * * @return array with context information */ protected function getTaskContext($context = null) { if (!$context) { $context = []; } if (!is_array($context)) { $context = ['task' => $context]; } if (!array_key_exists('task', $context)) { $context['task'] = $this; } return $context + TaskInfo::getTaskContext($context['task']); }