Commit 8ecd0f01 authored by Pascal Luna's avatar Pascal Luna

Adding the monolog.use_error_handler parameter to configure whether the...

Adding the monolog.use_error_handler parameter to configure whether the monolog ErrorHandler should be registered.

The error handler is now disabled by default when the application debug parameter is set to true, to ensure it won't silence exceptions and/or errors.
parent 46432144
...@@ -31,6 +31,14 @@ Parameters ...@@ -31,6 +31,14 @@ Parameters
* **monolog.exception.logger_filter** (optional): An anonymous function that * **monolog.exception.logger_filter** (optional): An anonymous function that
filters which exceptions should be logged. filters which exceptions should be logged.
* **monolog.use_error_handler** (optional): Whether errors and uncaught exceptions
should be handled by the Monolog ``ErrorHandler`` class and added to the log.
By default the error handler is enabled unless the application ``debug`` parameter
is set to true.
Please note that enabling the error handler may silence some errors,
ignoring the PHP ``display_errors`` configuration setting.
Services Services
-------- --------
......
...@@ -106,11 +106,14 @@ class MonologServiceProvider implements ServiceProviderInterface, BootableProvid ...@@ -106,11 +106,14 @@ class MonologServiceProvider implements ServiceProviderInterface, BootableProvid
$app['monolog.permission'] = null; $app['monolog.permission'] = null;
$app['monolog.exception.logger_filter'] = null; $app['monolog.exception.logger_filter'] = null;
$app['monolog.logfile'] = null; $app['monolog.logfile'] = null;
$app['monolog.use_error_handler'] = !$app['debug'];
} }
public function boot(Application $app) public function boot(Application $app)
{ {
ErrorHandler::register($app['monolog']); if ($app['monolog.use_error_handler']) {
ErrorHandler::register($app['monolog']);
}
if (isset($app['monolog.listener'])) { if (isset($app['monolog.listener'])) {
$app['dispatcher']->addSubscriber($app['monolog.listener']); $app['dispatcher']->addSubscriber($app['monolog.listener']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment