SwiftMailer spool:send命令-如何查看发送消息的详细信息?详细选项不工作



以下是SwiftMailer的send命令的--help选项的输出:

$ php bin/console swiftmailer:spool:send -help
Description:
Sends emails from the spool
Usage:
swiftmailer:spool:send [options]
Options:
--message-limit=MESSAGE-LIMIT      The maximum number of messages to send.
--time-limit=TIME-LIMIT            The time limit for sending messages (in seconds).
--recover-timeout=RECOVER-TIMEOUT  The timeout for recovering messages that have taken too long to send (in seconds).
--mailer=MAILER                    The mailer name.
--transport=TRANSPORT              The service of the transport to use to send the messages.
-h, --help                             Display this help message
-q, --quiet                            Do not output any message
-V, --version                          Display this application version
--ansi                             Force ANSI output
--no-ansi                          Disable ANSI output
-n, --no-interaction                   Do not ask any interactive question
-e, --env=ENV                          The Environment name. [default: "prod"]
--no-debug                         Switches off debug mode.
-v|vv|vvv, --verbose                   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
The swiftmailer:spool:send command sends all emails from the spool.
php bin/console swiftmailer:spool:send --message-limit=10 --time-limit=10 --recover-timeout=900 --mailer=default

我想用调试级别的冗长来运行它。但是,我得到的输出与正常运行命令时完全相同:

$ php bin/console swiftmailer:spool:send -vvv
[2021-10-15 12:11:22] Processing default mailer spool...
2 emails sent

我希望详细选项至少显示有关正在发送的消息的一些详细信息…有人知道不同的冗长程度应该显示什么样的输出吗?我是否在错误地使用它,如果是的话,获得详细输出的正确方法是什么?

冗长级别与特定命令无关。它是symfony/console组件的一部分,只是一种方法,让您(作为开发人员)控制响应用户的输入。

并非所有提供的命令都利用它,而且并不总是对它作出反应。如果你看看SymfonyBundleSwiftmailerBundleCommandSendEmailCommand.php内部,你不会发现无论是

if($this->io->getVerbosity()) { //... }

if($this->io->isVerbose()) { //... }

if($this->io->isVeryVerbose()) { //... }

所以swiftmailer:spool:send中没有-vvv的逻辑

所以一般来说,更高的篇幅只会给你更多关于错误的信息,例如,如果抛出任何异常,堆栈跟踪. ...除非你在自己的命令中实现了一些检查。

相关内容