less whitespace in logs

This commit is contained in:
Shish 2023-02-05 01:26:07 +00:00
parent 78dbcb8626
commit 09723bbcb9

View file

@ -130,7 +130,10 @@ class Database
{
global $_tracer, $tracer_enabled;
$dur = ftime() - $start;
$query = trim(preg_replace('/^[\n\t ]+/m', '', $query)); // trim whitespace
// trim whitespace
$query = preg_replace('/[\n\t ]/m', ' ', $query);
$query = preg_replace('/ +/m', ' ', $query);
$query = trim($query);
if ($tracer_enabled) {
$_tracer->complete($start * 1000000, $dur * 1000000, "DB Query", ["query"=>$query, "args"=>$args, "method"=>$method]);
}