From 36834c1118bb9c642b50441567bc687405e323ad Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 16 Feb 2012 08:46:48 -0600 Subject: [PATCH] add database.profile config option. --- application/config/database.php | 14 ++++++++++++++ laravel/database/connection.php | 7 +++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/application/config/database.php b/application/config/database.php index f4572ed5..55ca839b 100644 --- a/application/config/database.php +++ b/application/config/database.php @@ -2,6 +2,20 @@ return array( + /* + |-------------------------------------------------------------------------- + | Database Query Logging + |-------------------------------------------------------------------------- + | + | By default, the SQL, bindings, and execution time are logged in an array + | for you to review. They can be retrieved via the DB::profile() method. + | However, in some situations, you may want to disable logging for + | ultra high-volume database work. You can do so here. + | + */ + + 'profile' => true, + /* |-------------------------------------------------------------------------- | Default Database Connection diff --git a/laravel/database/connection.php b/laravel/database/connection.php index 43abe4e4..1ff34883 100644 --- a/laravel/database/connection.php +++ b/laravel/database/connection.php @@ -1,4 +1,4 @@ -log($sql, $bindings, $time); + if (Config::get('database.profile')) + { + $this->log($sql, $bindings, $time); + } return array($statement, $result); }