Is there a way to detect what verbosity level the user has specified when creating a custom artisan command? I don't see anything about it in the docs.
Is there a way to detect what verbosity level the user has specified when creating a custom artisan command? I don't see anything about it in the docs.
Symfony\Component\Console\Output\OutputInterface
中有getVerbosity()
函数,您可以使用$this->getOutput()
来检索输出对象.
$verbosityLevel = $this->getOutput()->getVerbosity();
然后,您可以将该级别与OutputInterface
内定义的常量进行比较.例如:
if($verbosityLevel >= OutputInterface::VERBOSITY_VERBOSE){
// show verbose messages
}