We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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



1.2k
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.



22.8k

Sweet!, thanks for the advice. I checked : https://docs.phalcon.io/en/latest/api/Phalcon_Logger_AdapterInterface.html Seems do-able. Thanks!