Added configuration variable to disable logging. Currently it is a boolean value, but eventually it will probably be broken out into an array with key/value pairs to correspond with the different logging options within the PICKLES core.
This commit is contained in:
parent
7fba0d231d
commit
3a89586eb1
6 changed files with 66 additions and 26 deletions
|
@ -128,14 +128,17 @@ class Database_PDO_Common extends Database_Common
|
|||
{
|
||||
$this->open();
|
||||
|
||||
$loggable_query = $sql;
|
||||
|
||||
if ($input_parameters != null)
|
||||
if ($this->config->pickles['logging'] === true)
|
||||
{
|
||||
$loggable_query .= ' -- ' . (JSON_AVAILABLE ? json_encode($input_parameters) : serialize($input_parameters));
|
||||
}
|
||||
$loggable_query = $sql;
|
||||
|
||||
Log::query($loggable_query);
|
||||
if ($input_parameters != null)
|
||||
{
|
||||
$loggable_query .= ' -- ' . (JSON_AVAILABLE ? json_encode($input_parameters) : serialize($input_parameters));
|
||||
}
|
||||
|
||||
Log::query($loggable_query);
|
||||
}
|
||||
|
||||
$sql = trim($sql);
|
||||
|
||||
|
@ -185,7 +188,7 @@ class Database_PDO_Common extends Database_Common
|
|||
$end_time = microtime(true);
|
||||
$duration = $end_time - $start_time;
|
||||
|
||||
if ($duration >= 1)
|
||||
if ($this->config->pickles['logging'] === true && $duration >= 1)
|
||||
{
|
||||
Log::slowQuery($duration . ' seconds: ' . $loggable_query);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue