Dispatches the given message to the inner Bus and Logs it.

@param object|Envelope $message
337458
public function dispatch($message): Envelope
    {
        $messageName = $this->getMessageName($message);

        if ($this->isIncoming($message)) {
            $this->decrementMessageQueueSize($messageName);
        } else {
            $this->incrementMessageQueueSize($messageName);
        }

        return $this->innerBus->dispatch($message);
    }
1104036
public function logMessage(Message $message): void
    {
        if (in_array($message->getLevel(), $this->config['log'])) {
            if ($this->config['send_immediately']) {

                call_user_func($this->config['exec'], $message);

            } else {
                $this->messages[] = $message;

                if (count($this->messages) == 1) {
                    // register shutdown on first message in queue
                    $self = $this;
                    register_shutdown_function(function () use ($self) {
                        $fn = $self->getExecFunction();
                        call_user_func($fn, $self->getMessages());
                    });
                }
            }
        }
    }
1095414
public function log($level, $message, array $context = array())
    {
        $this->getClient()->notify(
            $message,
            array_merge(['level' => $this->levelMapping[$level]], $this->getExtractor()->extract($context))
        );
    }
270787
public function log ($level, $message, array $context = array ()) {
		$this->_log (
			$this->convert_log_level ($level),
			$message,
			$context
		);
	}
1077178
public function log($level, $message, array $context = array())
    {
        if ($this->loggerInstance !== null) {
            $this->loggerInstance->log($level, $message, $context);
        } elseif ($this->loggerCallback !== null) {
            call_user_func_array($this->loggerCallback, array($level, $message, $context));
        }
    }
194334
protected function sendMessage(Message $message) {
		if(!$this->isIgnored($message)) {
			parent::sendMessage($message);
			$this->sentMessages[] = $message;
		}
	}
664055
protected function sendEmail($message): void
    {
        $snooze = \is_numeric($this->emailSnooze)
            ? $this->emailSnooze
            : \strtotime($this->emailSnooze) - \time();

        if ($this->email && $this->mailer
            && @\filemtime($this->directory . '/email-sent') + $snooze < \time() // @ file may not exist
            && @\file_put_contents($this->directory . '/email-sent', 'sent') // @ file may not be writable
        ) {
            ($this->mailer)($message, \implode(', ', (array) $this->email));
        }
    }
758292
protected function appendMessage(Message $message): void
    {
        $this->messages[] = $message;

        if (sizeof($this->messages) > 100) {
            array_shift($this->messages);
        }
    }
1359484
public function log($level, $message, array $context = array())
    {
        $this->dispatcher->dispatch(Log::EVENT_NAME, new Log($level, $message, $context, []));
    }
161868
public function log($level, $message, array $context = [])
    {
        if (in_array($level, $this->acceptedLevels, true)) {
            $this->logger->log($level, $message, $context);
        }
    }
1323957
public function log($level, $message)
    {
        if (func_num_args() > 3) {
            $args = array_slice(func_get_args(), 3);
            if (is_array($args[0])) {
                $args = $args[0];
            }
            $this->log->write($level, $this->className, $message, $args);
        } else {
            $this->log->write($level, $this->className, $message);
        }
    }
1264291
public function log($message, $level = LogLevel::DEBUG)
    {
        if ($this->logger instanceof LoggerInterface) {
            $this->logger->log($level, $message);
        }
    }
1221000
protected function consume(Message $message, Envelope $envelope = null) : bool
    {
        if (!$envelope instanceof Job) {
            throw new InvalidException(sprintf("Invalid class '%s'", get_class($envelope)));
        }

        try {
            $job = $envelope->getCommand();

            $options = json_encode($job->getInput()->getOptions());
            $arguments = json_encode($job->getInput()->getArguments());

            if (!$this->output->isDebug()) {
                $arguments = strlen($arguments) > 50 ? substr($arguments, 0, 50) . '...' : $arguments;
                $options = strlen($options) > 50 ? substr($options, 0, 50) . '...' : $options;
            }

            $this->output->writeln(sprintf(
                "New job with options '%s' and arguments '%s'",
                $envelope->getClass(),
                $options,
                $arguments
            ), OutputInterface::VERBOSITY_VERY_VERBOSE);

            $job->setOutput($this->output);

            $return = $job->execute($job->input, $this->output) == 0;

            return $return;
        } catch (\Throwable $exception) {
            if (!$exception instanceof \Exception) {
                $exception = new FatalThrowableError($exception);
            }

            $this->output->writeError(sprintf(
                "%s on job '%s' with message '%s'",
                get_class($exception),
                $envelope->getClass(),
                $exception->getMessage()
            ));

            Application::writeException($exception, $this->output, ConsoleOutputInterface::VERBOSITY_VERBOSE);

            self::emit(new ErrorEvent($exception));

            if ($this->input->getOption('retry') && !$exception instanceof FailureException) {
                if ($this->input->getOption('retry') > count($envelope->getHistory())) {
                    if ($this->input->getOption('stop-on-error')) {
                        $this->exitCode = 1;
                    }

                    $this->queue()->publish($envelope->serialize());
                    throw new ManualRequeueException($this->input->getOption('stop-on-error') === 1);
                } else {
                    $errorMessage = sprintf(
                        "Max retries %s reach for %s on job '%s' with message '%s'",
                        $this->input->getOption('retry'),
                        get_class($exception),
                        $envelope->getClass(),
                        $exception->getMessage()
                    );

                    $this->output->writeError($errorMessage);
                    throw new FailureException($message, $errorMessage, $exception);
                }
            }

            if ($this->input->getOption('stop-on-error') && !$exception instanceof FailureException) {
                $this->exitCode = 1;
                throw $exception;
            }

            return true;
        }
    }
1184837
public function log($level, $message, array $context = array())
    {
        if ($this->level > $level || array_key_exists($level, $this->levels) === false) {
            return;
        }

        $this->out($this->levels[$level], $message, $context);
    }
764393
protected function dispatchMessage($message): Envelope
    {
        if (!$this->container->has('messenger.default_bus')) {
            $message = class_exists(Envelope::class) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".';
            throw new \LogicException('The message bus is not enabled in your application. '.$message);
        }

        return $this->container->get('messenger.default_bus')->dispatch($message);
    }
1289132
public function send($to, $message)
    {
        $this->app->make('log')->log($this->level, 'SMS Messange was sent to '.$to.' with contents: '.$message);
    }
974604
public function logMessage(Message $message): void
    {
        if (in_array($message->getLevel(), $this->config['log'])) {
            // If script is running for very long time (e.g. CRON), then date might change if time passes midnight.
            // In that case, log will continue to write messages to new file.

            $fpFile = $this->getFileName();
            if ($fpFile !== $this->fpFile) {
                //date has changed? or we need to init?
                if ($this->fp) {
                    // close pointer to old file
                    @fclose($this->fp);
                }

                if ($this->config['path'] === null) {
                    $path = Application::getStoragePath('log' . DS . $fpFile);
                } else {
                    $path = str_replace(DS . DS, DS, $this->config['path'] . DS . $fpFile);
                }

                $this->fpFile = $fpFile;

                if (!($this->fp = @fopen($path, 'a'))) {
                    // file failed to open, maybe directory doesn't exists?
                    $dir = dirname($path);
                    if (!is_dir($dir)) {
                        Directory::mkdir($dir, $this->mode);
                    }

                    if (!($this->fp = @fopen($path, 'a'))) {
                        // now the directory should exists, so try to open file again
                        throw new Exception('Can not write to log file on path=' . $path);
                    }
                }
            }

            if (!$this->fp || $this->fp === null) {
                if ($this->config['path'] === null) {
                    $path = Application::getStoragePath('log' . DS . $fpFile);
                } else {
                    $path = str_replace(DS . DS, DS, $this->config['path'] . DS . $fpFile);
                }

                throw new Exception("Can not write to log file path={$path}");
            }

            if ($this->getMessageFunction !== null) {
                $line = call_user_func($this->getMessageFunction, $message);
            } else {
                $time = $message->getTime()->format('y-m-d H:i:s.v');
                $level = strtoupper($message->getLevel());
                $space = str_repeat(' ', 10 - strlen($level));
                $who = $message->getWho() ?? Log::getWho();
                $line = "{$time} {$level}{$space}{$who}\t{$message->getMessage()}\n";
            }

            if (!@fwrite($this->fp, $line)) { // actually write it in file
                throw new Exception('Unable to write to log file');
            }
        }
    }