From 68c087e85cb1678172478d67d106c239ccb2d878 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 14 May 2016 22:19:10 -0400 Subject: Update PicoDb --- app/ServiceProvider/DatabaseProvider.php | 9 +++++++-- app/Subscriber/BootstrapSubscriber.php | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/ServiceProvider/DatabaseProvider.php b/app/ServiceProvider/DatabaseProvider.php index 26662b8a..c0dcd366 100644 --- a/app/ServiceProvider/DatabaseProvider.php +++ b/app/ServiceProvider/DatabaseProvider.php @@ -20,8 +20,13 @@ class DatabaseProvider implements ServiceProviderInterface public function register(Container $container) { $container['db'] = $this->getInstance(); - $container['db']->stopwatch = DEBUG; - $container['db']->logQueries = DEBUG; + + if (DEBUG) { + $container['db']->getStatementHandler() + ->withLogging() + ->withStopWatch() + ; + } return $container; } diff --git a/app/Subscriber/BootstrapSubscriber.php b/app/Subscriber/BootstrapSubscriber.php index 7e341601..a376a935 100644 --- a/app/Subscriber/BootstrapSubscriber.php +++ b/app/Subscriber/BootstrapSubscriber.php @@ -32,10 +32,10 @@ class BootstrapSubscriber extends BaseSubscriber implements EventSubscriberInter $this->logger->debug($message); } - $this->logger->debug('SQL_QUERIES={nb}', array('nb' => $this->container['db']->nbQueries)); - $this->logger->debug('RENDERING={time}', array('time' => microtime(true) - $this->request->getStartTime())); - $this->logger->debug('MEMORY='.$this->helper->text->bytes(memory_get_usage())); - $this->logger->debug('URI='.$this->request->getUri()); + $this->logger->debug('nb_queries={nb}', array('nb' => $this->db->getStatementHandler()->getNbQueries())); + $this->logger->debug('rendering_time={time}', array('time' => microtime(true) - $this->request->getStartTime())); + $this->logger->debug('memory_usage='.$this->helper->text->bytes(memory_get_usage())); + $this->logger->debug('uri='.$this->request->getUri()); $this->logger->debug('###############################################'); } } -- cgit v1.2.3