Pushing the ConsoleHandler to the Monolog "app" logger instance in Symfony2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... see http://symfony.com/doc/current/components/console/introduction.html#creating-a-basic-command | |
namespace Acme\DemoBundle\Command; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Bridge\Monolog\Handler\ConsoleHandler; | |
class GreetCommand extends Command | |
{ | |
protected function configure() { ... } | |
protected function execute(InputInterface $input, OutputInterface $output) | |
{ | |
$container->get('logger')->pushHandler(new ConsoleHandler($output)); | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment