Esempio n. 1
0
File: Log.php Progetto: nabble/ajde
 /**
  * @param Throwable $exception
  */
 public static function logException($exception)
 {
     $type = Ajde_Exception_Handler::getTypeDescription($exception);
     $level = Ajde_Exception_Handler::getExceptionLevelMap($exception);
     $channel = Ajde_Exception_Handler::getExceptionChannelMap($exception);
     $trace = strip_tags(Ajde_Exception_Handler::trace($exception, Ajde_Exception_Handler::EXCEPTION_TRACE_ONLY));
     Ajde_Log::_($exception->getMessage(), $channel, $level, $type, sprintf('%s on line %s', $exception->getFile(), $exception->getLine()), $trace);
 }
Esempio n. 2
0
function shutdown()
{
    if (($error = error_get_last()) && in_array($error['type'], array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR))) {
        $exception = new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']);
        if (Config::get('debug') === true) {
            echo Ajde_Exception_Handler::trace($exception);
        } else {
            // Use native PHP error log function, as Ajde_Exception_Log does not work
            error_log($error['message'] . ', ' . $error['type'] . ', ' . $error['file'] . ', ' . $error['line']);
            Ajde_Http_Response::dieOnCode(Ajde_Http_Response::RESPONSE_TYPE_SERVERERROR);
        }
    }
}
Esempio n. 3
0
 public static function logException(Exception $exception)
 {
     $trace = strip_tags(Ajde_Exception_Handler::trace($exception, Ajde_Exception_Handler::EXCEPTION_TRACE_LOG));
     Ajde_Log::log($trace);
 }
Esempio n. 4
0
 public function log($ident, $module)
 {
     Ajde_Log::_('Language key [' . $module . '.' . $ident . '] not found for language [' . Ajde_Lang::getInstance()->getLang() . ']', Ajde_Log::CHANNEL_INFO, Ajde_Log::LEVEL_DEBUG, '', '', strip_tags(Ajde_Exception_Handler::trace(new Ajde_Exception(), Ajde_Exception_Handler::EXCEPTION_TRACE_ONLY)));
 }