PSR-3 Logger support

As PSR-3 has become a Standard Recommendation, I would encourage you to implement it into the framework. This way we could use third-party logger libraries like Monolog.

https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md

thanks



84.5k

Thanks for the recommendation, but Phalcon is a highly decoupled framework and our Logging component is not a dependency of other components, you can use Monolog or any other component for logging without problem,

For example, to log the database queries sent to the database server using Monolog: ```php $eventsManager = new Phalcon\Events\Manager();

$log = new Monolog\Logger('name'); $log->pushHandler(new Monolog\Handler\StreamHandler('logs/db.log', Logger::WARNING));

//Listen all the database events $eventsManager->attach('db', function($event, $connection) use ($log) { if ($event->getType() == 'beforeQuery') { $log->addDebug($connection->getSQLStatement()); } });

//Assign the eventsManager to the db adapter instance $connection->setEventsManager($eventsManager);

//Execute some SQL statement $connection->insert( "products", array("Hot pepper", 3.50), array("name", "price") ); ```

here is typo, should be $logger than $log please correct and remove my comment :)



84.5k

thanks @doit76, corrected

thanks for the example @Phalcon I see the concept more clearer