/** * Logs an Error, should be in Config, but that doesn't extend permissions * @param string $error The error stacktrace * @throws \Exception */ public function logError($error) { if (!is_string($error)) { throw $this->throwException(2003); } $error = strip_tags($error); Log::addToLog('-------------------------------------------'); Log::addToLog(date('r') . ':'); Log::addToLog($error); Log::addToLog('-------------------------------------------'); $mailer = new Mailer(); $message = 'An error occurred at ' . date('r') . ' on ' . SITENAME . "\r\nThe stacktrace is:\r\n" . $error; $mailer->sendPlainMail(SYSMAIL, SYSMAIL, 'Bright Error', $message); }
public function throwException($id, $vars = null) { Log::addToLog("Error {$id} " . print_r($vars, true)); if (array_key_exists($id, $this->_exceptions)) { $exc = $this->_exceptions[$id]; if ($vars) { if (!is_array($vars)) { $vars = array($vars); } for ($i = 0; $i < count($vars); $i++) { $exc = str_replace('#' . $i, $vars[$i], $exc); } } return new \Exception($exc, $id); } return new \Exception('An unspecified error occured', $id); }