Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voryx_thruway.enable_logging doesn't act as expected #61

Open
roissard opened this issue Mar 17, 2017 · 0 comments
Open

voryx_thruway.enable_logging doesn't act as expected #61

roissard opened this issue Mar 17, 2017 · 0 comments

Comments

@roissard
Copy link

roissard commented Mar 17, 2017

When setting voryx_thruway.enable_logging flag to false, the code in VoryxThruwayExtension.php is called only on the first run. When you relaunch the command a bit later, the log is still displayed on the console.

A suggestion would be to connect the Symfony 'logger' service to the Thruway\Logging\Logger so that the command can take benefit of -v -vv and -vvv options.

It is easy to achieve that outside of ThruwayBundle using the following code:

use Symfony\Component\Console\Event\ConsoleCommandEvent;

use Psr\Log\NullLogger;
use Thruway\Logging\Logger;

class SetVoryxLoggerListener
{

    public function onConsoleCommand(ConsoleCommandEvent $event)
    {
        Logger::set($event->getDispatcher()->getContainer()->get('logger'));
    }
}

And declare a service:

    voryx.thruway.setvorxylogger:
        class: Visioglobe\MapEditorBundle\Listener\SetVoryxLoggerListener
        tags:
            - { name: kernel.event_listener, event: console.command }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant