Extend debug mode

Messages with status 400+ can be logged.
This commit is contained in:
Visman 2023-04-30 13:17:41 +07:00
parent d24556d803
commit 0dc8a80645
4 changed files with 14 additions and 3 deletions

View file

@ -23,7 +23,7 @@ class Debug extends Page
$this->numQueries = $this->c->DB->getCount();
if (
$this->c->DEBUG > 1
2 & $this->c->DEBUG
&& $this->user->isAdmin
) {
$total = 0;

View file

@ -52,6 +52,17 @@ class Message extends Page
if ('' !== $message) {
$this->fIswev = [$type, $message];
if (
$status > 399
&& 4 & $this->c->DEBUG
) {
$this->c->Log->debug("Status {$status}: {$_SERVER['REQUEST_URI']}", [
'user' => $this->user->fLog(),
'message' => $message,
'headers' => true,
]);
}
}
return $this;

View file

@ -87,7 +87,7 @@ if (
if (
null !== $tpl
&& $c->DEBUG > 0
&& 3 & $c->DEBUG
) {
$debug = \rtrim($c->View->rendering($c->Debug->debug()));
$tpl = \str_replace('<!-- debuginfo -->', $debug, $tpl);

View file

@ -35,7 +35,7 @@ return [
'algo' => 'sha1',
'salt' => '_SALT_FOR_HMAC_',
],
'DEBUG' => 0,
'DEBUG' => 0, // 1st&2nd: time/memory, 2nd: queries, 3rd: message 400+ to log
'MAINTENANCE_OFF' => false,
'BBCODE_INFO' => [
'smTpl' => '<img src="{url}" alt="{alt}">',