This commit is contained in:
Thomas Zilio 2019-02-15 10:42:39 +01:00
parent cc0a41b14d
commit bb70fb7f4e
2 changed files with 17 additions and 14 deletions

View File

@ -87,6 +87,17 @@ if (!API::isAPIRequest()) {
}
$whoops->register();
// Aggiunta di Monolog a Whoops
$whoops->pushHandler(function ($exception, $inspector, $run) use ($logger) {
$logger->addError($exception->getMessage(), [
'code' => $exception->getCode(),
'message' => $exception->getMessage(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'trace' => $exception->getTraceAsString(),
]);
});
} else {
$handlers[] = new StreamHandler($docroot.'/logs/api.log', Monolog\Logger::ERROR);
}
@ -109,19 +120,6 @@ foreach ($handlers as $handler) {
// Imposta Monolog come gestore degli errori
Monolog\ErrorHandler::register($logger, [], Monolog\Logger::ERROR, Monolog\Logger::ERROR);
// Aggiunta di Monolog a Whoops
if (App::debug()) {
$whoops->pushHandler(function ($exception, $inspector, $run) use ($logger) {
$logger->addError($exception->getMessage(), [
'code' => $exception->getCode(),
'message' => $exception->getMessage(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'trace' => $exception->getTraceAsString(),
]);
});
}
// Database
$dbo = $database = database();

View File

@ -29,8 +29,13 @@ class MessageHandler extends AbstractProcessingHandler
}
}
flash()->error($message);
// Messaggio nella sessione
try {
flash()->error($message);
} catch (\Exception $e) {
}
// Messaggio visivo immediato
echo '
<div class="alert alert-danger push">
<i class="fa fa-times"></i> '.$message.'