summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2014-03-06 12:26:17 +0100
committerNathan Gass2014-03-06 12:26:27 +0100
commita98cd90f1e5889fa586205d12c65209f91361cab (patch)
tree34ad532933c83b8c5ff3885fba9a32780edb49e3
parentd1b74acb0d87b50c9447504edd811032fdbbaa71 (diff)
downloaditools-a98cd90f1e5889fa586205d12c65209f91361cab.tar.gz
itools-a98cd90f1e5889fa586205d12c65209f91361cab.tar.bz2
itools-a98cd90f1e5889fa586205d12c65209f91361cab.zip
truncate large queries for slow log
-rw-r--r--it_dbi.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 57c64a3..7425275 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -483,7 +483,8 @@ function query($query, $p = array())
if ($GLOBALS['debug_sqllog'] || $GLOBALS['debug_sqltrace'] || $slow)
{
$backtrace = (EDC('sqltrace') || $slow) ? it_debug::backtrace(1) : null;
- it::log('sqllog', "$msec\t$query\t$backtrace\t" . $this->_p['server'] . ($slow ? "\tSLOW" : ""));
+ $truncquery = strlen($query) > 1000 ? mb_substr($query, 0, 1000) . '...' : $query;
+ it::log('sqllog', "$msec\t$truncquery\t$backtrace\t" . $this->_p['server'] . ($slow ? "\tSLOW" : ""));
$this->_sqllog[] = array(
'time' => $msec,