Files
spa-api/application/config/error.php

87 lines
2.6 KiB
PHP
Raw Normal View History

2011-10-05 18:32:48 -05:00
<?php
return array(
/*
|--------------------------------------------------------------------------
| Error Detail
|--------------------------------------------------------------------------
|
2011-11-02 21:27:43 -05:00
| Detailed error messages contain information about the file in which an
| error occurs, as well as a PHP stack trace containing the call stack.
2011-10-05 18:32:48 -05:00
|
| If your application is in production, consider turning off error details
2011-11-02 21:27:43 -05:00
| for enhanced security and user experience. The error stack trace could
| contain sensitive information that should not be publicly visible.
2011-10-05 18:32:48 -05:00
|
*/
'detail' => true,
/*
|--------------------------------------------------------------------------
| Error Logging
|--------------------------------------------------------------------------
|
2011-11-02 21:27:43 -05:00
| When error logging is enabled, the "logger" Closure defined below will
| be called for every error in your application. You are free to log the
| errors however you want. Enjoy the flexibility.
2011-10-05 18:32:48 -05:00
|
*/
'log' => false,
/*
|--------------------------------------------------------------------------
| Error Handler
|--------------------------------------------------------------------------
|
| Because of the various ways of managing error logging, you get complete
2011-11-02 21:27:43 -05:00
| flexibility in Laravel to manage all error logging as you see fit.
2011-10-05 18:32:48 -05:00
|
| This function will be called when an error occurs in your application.
2011-11-02 21:27:43 -05:00
| You are free to handle the exception any way you want. The severity
| will be a human-readable severity level such as "Parsing Error".
2011-10-05 18:32:48 -05:00
|
*/
'handler' => function($exception, $severity, $message, $config)
{
2011-11-02 21:27:43 -05:00
if ($config['detail'])
{
$data = compact('exception', 'severity', 'message');
2011-10-05 18:32:48 -05:00
2011-11-02 21:27:43 -05:00
$response = Response::view('error.exception', $data)->status(500);
}
else
{
$response = Response::error('500');
}
2011-10-05 18:32:48 -05:00
2011-11-02 21:27:43 -05:00
$response->send();
2011-10-05 18:32:48 -05:00
},
/*
|--------------------------------------------------------------------------
| Error Logger
|--------------------------------------------------------------------------
|
| Because of the various ways of managing error logging, you get complete
2011-11-02 21:27:43 -05:00
| flexibility to manage error logging as you see fit. This function will
| be called anytime an error occurs within your application and error
| logging is enabled.
2011-10-05 18:32:48 -05:00
|
2011-11-02 21:27:43 -05:00
| You may log the error message however you like; however, a simple logging
| solution has been setup for you which will log all error messages to a
| single text file within the application storage directory.
2011-10-05 18:32:48 -05:00
|
*/
'logger' => function($exception, $severity, $message, $config)
{
2011-11-02 21:27:43 -05:00
$message = date('Y-m-d H:i:s').' '.$severity.' - '.$message.PHP_EOL;
File::append(STORAGE_PATH.'log.txt', $message);
2011-10-05 18:32:48 -05:00
}
);