Minor improvements (#824)

This commit is contained in:
Roman Kelesidis 2023-06-30 14:22:26 +07:00 committed by GitHub
commit a9e0a975dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View file

@ -86,7 +86,7 @@ ini_set('display_startup_errors', 1); // Show startup php errors
define('MYSQLI_ERROR_REPORTING', MYSQLI_REPORT_ERROR); // MySQL error reporting mode | https://www.php.net/manual/mysqli-driver.report-mode.php
ini_set('log_errors', 1); // php native logging
ini_set('error_log', LOG_DIR . '/php_errors.log'); // path to log file enabled only if log_errors == 1 (native)
define('WHOOPS_LOG_FILE', LOG_DIR . '/php_whoops.log'); // log file enabled only if log_errors == 1 (whoops)
define('WHOOPS_LOG_FILE', LOG_DIR . '/php_whoops.log'); // log file enabled only if log_errors == 1 and APP_DEBUG == true (whoops)
// Triggers
define('BB_ENABLED', TRIGGERS_DIR . '/$on');

View file

@ -43,21 +43,11 @@ class Dev
*/
public static function initDebug(): void
{
global $bb_cfg;
self::$envType = env('APP_ENV', 'local');
if (self::$envType === 'production') {
if (!$bb_cfg['bugsnag']['enabled']) {
return;
}
self::getBugsnag();
} else {
if (!APP_DEBUG) {
return;
}
self::getWhoops();
}
}
@ -71,6 +61,10 @@ class Dev
{
global $bb_cfg;
if (!$bb_cfg['bugsnag']['enabled']) {
return;
}
$bugsnag = Client::make($bb_cfg['bugsnag']['api_key']);
Handler::register($bugsnag);
}
@ -82,6 +76,10 @@ class Dev
*/
private static function getWhoops(): void
{
if (!APP_DEBUG) {
return;
}
$whoops = new Run;
/**