diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ErrorHandler/HandleShutdownError.php | 9 | ||||
-rw-r--r-- | src/ErrorHandler/HandleUncaughtError.php | 2 | ||||
-rw-r--r-- | src/ErrorHandler/HandleUncaughtException.php | 9 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/ErrorHandler/HandleShutdownError.php b/src/ErrorHandler/HandleShutdownError.php index 1e9907b..3397717 100644 --- a/src/ErrorHandler/HandleShutdownError.php +++ b/src/ErrorHandler/HandleShutdownError.php @@ -47,6 +47,13 @@ trait HandleShutdownError */ abstract public function log($error); + /** + * Get the types of errors that will be logged + * + * @return int Binary set of E_* constants + */ + abstract public function getLoggedErrorTypes(); + /** * Reserve memory for shutdown function in case of out of memory @@ -86,7 +93,7 @@ trait HandleShutdownError $error = new \ErrorException($err['message'], 0, $err['type'], $err['file'], $err['line']); - if ($err['type'] & $this->logErrorTypes) { + if ($err['type'] & $this->getLoggedErrorTypes()) { $this->log($error); } diff --git a/src/ErrorHandler/HandleUncaughtError.php b/src/ErrorHandler/HandleUncaughtError.php index 91b28f3..fa2be0a 100644 --- a/src/ErrorHandler/HandleUncaughtError.php +++ b/src/ErrorHandler/HandleUncaughtError.php @@ -141,7 +141,7 @@ trait HandleUncaughtError throw $error; } - if ($this->logErrorTypes & $type) { + if ($this->getLoggedErrorTypes() & $type) { $this->log($error); } } diff --git a/src/ErrorHandler/HandleUncaughtException.php b/src/ErrorHandler/HandleUncaughtException.php index 7a01bb1..4386c84 100644 --- a/src/ErrorHandler/HandleUncaughtException.php +++ b/src/ErrorHandler/HandleUncaughtException.php @@ -44,6 +44,13 @@ trait HandleUncaughtException */ abstract public function log($error); + /** + * Get the types of errors that will be logged + * + * @return int Binary set of E_* constants + */ + abstract public function getLoggedErrorTypes(); + /** * Get the error handler that has been replaced. @@ -107,7 +114,7 @@ trait HandleUncaughtException if ($exception instanceof \Error || $exception instanceof \ErrorException) { $type = $exception instanceof \Error ? $exception->getCode() : $exception->getSeverity(); - $shouldLog = $this->logErrorTypes & $type; + $shouldLog = $this->getLoggedErrorTypes() & $type; } else { $shouldLog = array_sum($isInstanceOf) > 0; } |