mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
Updated
This commit is contained in:
parent
af47c51ce8
commit
d3fe1b788d
2 changed files with 24 additions and 7 deletions
|
@ -462,7 +462,7 @@ $bb_cfg['adv_email'] = "adv@$domain_name"; // advertisement email
|
|||
|
||||
// Error reporting
|
||||
$bb_cfg['whoops'] = [
|
||||
'enabled' => true,
|
||||
'error_message' => 'Sorry, something went wrong. Drink coffee and come back after some time... ☕️',
|
||||
'blacklist' => [
|
||||
'_COOKIE' => array_keys($_COOKIE),
|
||||
'_SERVER' => array_keys($_SERVER),
|
||||
|
|
29
src/Dev.php
29
src/Dev.php
|
@ -47,8 +47,12 @@ class Dev
|
|||
$this->whoops = new Run;
|
||||
|
||||
if (DBG_USER) {
|
||||
$this->getWhoops();
|
||||
$this->getWhoopsOnPage();
|
||||
} else {
|
||||
$this->getWhoopsPlaceholder();
|
||||
}
|
||||
$this->getWhoopsLogger();
|
||||
|
||||
$this->getBugsnag();
|
||||
$this->getTelegramSender();
|
||||
|
||||
|
@ -97,14 +101,10 @@ class Dev
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function getWhoops(): void
|
||||
private function getWhoopsOnPage(): void
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
if (!$bb_cfg['whoops']['enabled']) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show errors on page
|
||||
*/
|
||||
|
@ -127,7 +127,10 @@ class Dev
|
|||
->setFormatter((new LineFormatter(null, null, true)))]
|
||||
)));
|
||||
$this->whoops->pushHandler($loggingInConsole);
|
||||
}
|
||||
|
||||
private function getWhoopsLogger(): void
|
||||
{
|
||||
/**
|
||||
* Log errors in file
|
||||
*/
|
||||
|
@ -143,6 +146,20 @@ class Dev
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whoops production debug driver
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function getWhoopsPlaceholder(): void
|
||||
{
|
||||
$this->whoops->pushHandler(function ($e) {
|
||||
global $bb_cfg;
|
||||
echo $bb_cfg['whoops']['error_message'];
|
||||
echo "<hr>Error: {$e->getMessage()}.";
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SQL debug log
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue