Jobs and the console
Permalink
Hi,
really happy with the console, and running jobs from the console. Cool stuff
I would like to add a bit more information in my jobs when i run them in the console, so using the verbose methods provided by the symphony console would sound logically.
i can easily get access to an output handle by using:
$output = new \Symfony\Component\Console\Output\ConsoleOutput\ConsoleOutput();
this allows me to do things like: $output->writeln("<info>starting</info>") to the console! Great stuff. But what i would like to do is:
if ($output->isQuiet()) { // ...}
if ($output->isVerbose()) { // ...}
if ($output->isVeryVerbose()) { // ...}
if ($output->isDebug()) { // ...}
just using ConsoleOutput() does not give me the context of the actual console.....
Anyone any idea?
Thanks
\m/
really happy with the console, and running jobs from the console. Cool stuff
I would like to add a bit more information in my jobs when i run them in the console, so using the verbose methods provided by the symphony console would sound logically.
i can easily get access to an output handle by using:
$output = new \Symfony\Component\Console\Output\ConsoleOutput\ConsoleOutput();
this allows me to do things like: $output->writeln("<info>starting</info>") to the console! Great stuff. But what i would like to do is:
if ($output->isQuiet()) { // ...}
if ($output->isVerbose()) { // ...}
if ($output->isVeryVerbose()) { // ...}
if ($output->isDebug()) { // ...}
just using ConsoleOutput() does not give me the context of the actual console.....
Anyone any idea?
Thanks
\m/
created a solution for the myself:
this will check for the console arguments in the args array and returns the verbosity level.
Now when you want to create a console output, do the following:
This will give you all the nice things the console has to offer: