本文整理汇总了PHP中Kohana_Exception::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana_Exception::log方法的具体用法?PHP Kohana_Exception::log怎么用?PHP Kohana_Exception::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana_Exception
的用法示例。
在下文中一共展示了Kohana_Exception::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_response
/**
* Generate a Response for the 404 Exception.
*
* The user should be shown a nice 404 page.
*
* @return Response
*/
public function get_response()
{
Kohana_Exception::log($this);
$response = Request::factory(Route::get('default')->uri(array('controller' => 'Errors', 'action' => '404')))->execute();
$response->status(404);
return $response;
}
示例2: handler
/**
* Inline exception handler, displays the error message, source of the
* exception, and the stack trace of the error.
*
* Should this display a stack trace? It's useful.
*
* @uses Kohana_Exception::text
* @param Exception $e
* @return boolean
*/
public static function handler(Exception $e)
{
try {
// Log the exception
Kohana_Exception::log($e);
if ($e instanceof Minion_Exception) {
echo $e->format_for_cli();
} else {
echo Kohana_Exception::text($e);
}
$exit_code = $e->getCode();
// Never exit "0" after an exception.
if ($exit_code == 0) {
$exit_code = 1;
}
exit($exit_code);
} catch (Exception $e) {
// Clean the output buffer if one exists
ob_get_level() and ob_clean();
// Display the exception text
echo Kohana_Exception::text($e), "\n";
// Exit with an error status
exit(1);
}
}
示例3: response
public static function response(Exception $e)
{
// get the response
$response = parent::response($e);
// Log the Exception,
Kohana_Exception::log($e);
if (Kohana::DEVELOPMENT !== Kohana::$environment) {
try {
// fire error subrequest
// directly output result
echo Request::factory(Route::get('error')->uri(array('controller' => 'error', 'action' => 'view')))->post('exception', $e)->execute()->send_headers()->body();
exit;
} catch (Exception $e) {
// Clean the output buffer if one exists
ob_get_level() and ob_clean();
// Display the exception text
echo parent::text($e);
// Exit with an error status
exit;
}
}
// end all output buffering
$ob = ob_get_level();
for ($i = 0; $i < $ob; $i++) {
ob_end_clean();
}
// return the response as usual
return $response;
}
开发者ID:yubinchen18,项目名称:A-basic-website-project-for-a-company-using-the-MVC-pattern-in-Kohana-framework,代码行数:29,代码来源:Exception.php
示例4: log
/**
* @param Exception $e
*/
protected static function log(Exception $e)
{
$logLevel = self::config('cache.log.exceptions', static::$logExceptions);
if (FALSE !== $logLevel) {
Kohana_Exception::log($e, $logLevel);
}
}
示例5: get_response
public function get_response()
{
Kohana_Exception::log($this);
if (Kohana::$environment >= Kohana::DEVELOPMENT) {
return parent::get_response();
} else {
$response = Response::factory()->status(401)->headers('Location', URL::site('/'));
return $response;
}
}
示例6: get_response
/**
* Generates a Response for all Exceptions without a specific override
*
* @return Response
*/
public function get_response()
{
// Log the exception
Kohana_Exception::log($this);
$response = Response::factory();
$view = Swiftriver::get_base_error_view();
$view->content = View::factory('pages/errors/404')->set('page', $this->request()->uri());
$response->body($view->render());
return $response;
}
示例7: get_response
public function get_response()
{
// Lets log the Exception, Just in case it's important!
Kohana_Exception::log($this);
$params = array('code' => $this->getCode(), 'message' => rawurlencode($this->getMessage()), 'response' => NULL, 'errors' => $this->_errors);
try {
return json_encode($params);
} catch (Exception $e) {
return parent::get_response();
}
}
示例8: get_response
public function get_response()
{
Kohana_Exception::log($this);
if (Kohana::$environment >= Kohana::DEVELOPMENT) {
return parent::get_response();
} else {
$view = View::factory('templates/errors/default');
$view->set('title', "400 Bad Request");
$view->set('message', "{$this->getMessage()}");
$response = Response::factory()->status(400)->body($view->render());
return $response;
}
}
示例9: get_response
/**
* Generate a Response for all Exceptions without a more specific override
*
* The user should see a nice error page, however, if we are in development
* mode we should show the normal Kohana error page.
*
* @return Response
*/
public function get_response()
{
// Lets log the Exception, Just in case it's important!
Kohana_Exception::log($this);
if (Kohana::$environment >= Kohana::DEVELOPMENT) {
// Show the normal Kohana error page.
return parent::get_response();
} else {
$response = Request::factory(Route::get('default')->uri(array('controller' => 'Errors', 'action' => 'index')))->execute();
$response->status($this->getCode());
return $response;
}
}
示例10: get_response
public function get_response()
{
Kohana_Exception::log($this);
if (Kohana::$environment >= Kohana::DEVELOPMENT) {
return parent::get_response();
} else {
$view = View::factory('templates/errors/default');
$view->set('title', 'Произошла ошибка');
$view->set('message', $this->getMessage());
$response = Response::factory()->status($this->getCode())->body($view->render());
Model_Methods::telegram_send_error($this->getMessage());
return $response;
}
}
示例11: get_response
/**
* Generate a Response for all Exceptions without a more specific override
*
* The user should see a nice error page, however, if we are in development
* mode we should show the normal Kohana error page.
*
* @return Response
*/
public function get_response()
{
// Lets log the Exception, Just in case it's important!
Kohana_Exception::log($this);
if (Kohana::$environment >= Kohana::DEVELOPMENT) {
// Show the normal Kohana error page.
return parent::get_response();
} else {
// Generate a nicer looking "Oops" page.
$view = View::factory('error/default');
$response = Response::factory()->status($this->getCode())->body($view->render());
return $response;
}
}
示例12: get_response
/**
* Generate a Response for all Exceptions without a more specific override
*
* The user should see a nice error page, however, if we are in development
* mode we should show the normal Kohana error page.
*
* @return Response
*/
public function get_response()
{
// Lets log the Exception, Just in case it's important!
Kohana_Exception::log($this);
$params = array('code' => 500, 'message' => rawurlencode($this->getMessage()), 'response' => NULL);
if ($this instanceof HTTP_Exception) {
$params['code'] = $this->getCode();
}
try {
return json_encode($params);
} catch (Exception $e) {
return parent::get_response();
}
}
示例13: get_response
/**
* Generate a Response for all Exceptions without a more specific override
* The user should see a nice error page, however, if we are in development
* mode we should show the normal Kohana error page.
*
* @return Response
*/
public function get_response()
{
// Lets log the Exception, Just in case it's important!
Kohana_Exception::log($this);
if (Kohana::$environment >= Kohana::DEVELOPMENT) {
// Show the normal Kohana error page.
return parent::get_response();
} else {
$attributes = ['action' => 500];
// Get error code as action name
if ($this instanceof HTTP_Exception) {
$attributes['action'] = $this->getCode();
$attributes['message'] = $this->getMessage();
}
// Execute the query, addressed to the router for error handling
return Request::factory(Route::get('error')->uri($attributes))->execute();
}
}
示例14: handler
public static function handler($e)
{
try {
Kohana_Exception::log($e);
if (PHP_SAPI == 'cli') {
$response = Kohana_Exception::text($e);
} else {
$response = Kohana_Exception::response($e);
}
echo $response;
exit(1);
} catch (Exception $e) {
ob_get_level() and ob_clean();
header('Content-Type: text/plain; charset=utf-8', TRUE, 500);
echo Kohana_Exception::text($e);
exit(1);
}
}
示例15: get_response
/**
* Run CSRF check and load frontend assets.
*/
public function get_response()
{
// Lets log the Exception, Just in case it's important!
Kohana_Exception::log($this);
if (Kohana::$environment >= Kohana::DEVELOPMENT) {
// Show the normal Kohana error page.
return parent::get_response();
}
$response = Response::factory();
$assets = Kohana::$config->load('assets.global');
$this->_load_assets($assets);
$view = new View_Error();
$view->title = $this->getCode();
$view->message = $this->getMessage();
$renderer = Kostache_Layout::factory();
$response->body($renderer->render($view));
return $response;
}