Update query log to be more useful

This commit is contained in:
Sky Johnson 2024-12-14 14:12:14 -06:00
parent adcd4166c6
commit 02533addb4
2 changed files with 9 additions and 3 deletions

View File

@ -5,7 +5,7 @@ require_once __DIR__ . '/database.php';
define('VERSION', '1.2.5');
define('BUILD', 'Reawaken');
define('START', microtime(true));
define('DEBUG', true);
define('DEBUG', false);
/**
* Open or get SQLite database connection.
@ -213,7 +213,7 @@ function display($content, $title, bool $topnav = true, bool $leftnav = true, bo
"numqueries" => db()->count,
"version" => VERSION,
"build" => BUILD,
"querylog" => DEBUG ? '<pre>'.print_r(db()->log, true).'</pre>' : ''
"querylog" => DEBUG ? db()->log : []
]);
exit;

View File

@ -39,7 +39,13 @@
<div>Version <?= $version ?> <?= $build ?></div>
</footer>
<?= $querylog ?>
<?php
if (!empty($querylog)) {
echo '<pre>';
foreach ($querylog as $record) echo '<div>['.round($record[1], 2)."s] {$record[0]}</div>";
echo '</pre>';
}
?>
</div>
</body>
</html>