Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How do I disable FirePHP logging?

Hi All,

I have the following logging service setup in my services.php. My question is basically how do I stop the firePHP output from displaying using a boolean flag?

    $di->set('logger',function() use($config){
        $logger = new Phalcon\Logger\Adapter\Firephp('debug', null); // null  
        //$logger->setEnabled($config->debug); // this only works when including the fire.php file
        //$logger->log('Logging enabled...'); // use this to display arrays
        // how do i disable the logging?
        return $logger;
    });

Any advice / help greatly appreciated.

Thanks



654
Accepted
answer

All I can think of is create an adapter that does nothing \Namespace\Logger\Adapter\None which implements Phalcon\Logger\AdapterInterface

Set up all the required methods to not do anything. Just return false or null. Then use a config in your services.php as to what logging adapter you want to use and specify the None adapter.

Or extend the firephp adapter and tweak it to have a disabled method.

Just a couple thoughts.



13.1k

Sweet!, thanks for the advice. I checked : http://docs.phalconphp.com/en/latest/api/Phalcon%5Logger%5AdapterInterface.html Seems do-able. Thanks!