Created
January 10, 2018 21:47
-
-
Save macintoshplus/b26fa1eb31fb5862abd4b08bd9e90c45 to your computer and use it in GitHub Desktop.
Log All deprecated into file log (not web toolbar)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\HttpFoundation\Request; | |
require_once("vendor/autoload.php"); | |
$app = new \Silex\Application(); | |
$app['debug'] = true; | |
$app->register(new \Silex\Provider\MonologServiceProvider(), ['monolog.use_error_handler'=>false, 'monolog.logfile'=>__DIR__.'/php.log']); | |
$app->register(new \Silex\Provider\HttpFragmentServiceProvider()); | |
$app->register(new \Silex\Provider\ServiceControllerServiceProvider()); | |
$app->register(new \Silex\Provider\TwigServiceProvider()); | |
$app->register(new \Silex\Provider\WebProfilerServiceProvider(), array( | |
'profiler.cache_dir' => __DIR__.'/cache/profiler', | |
'profiler.mount_prefix' => '/_profiler', // this is the default | |
)); | |
$app->get('/', function () use ($app) { | |
$app['logger']->info('toto'); | |
dump(E_USER_DEPRECATED, E_ALL, E_STRICT, E_ALL | E_STRICT, E_ALL & E_USER_DEPRECATED); | |
@trigger_error('deprecated', E_USER_DEPRECATED); | |
@trigger_error('user warning', E_NOTICE); | |
return new Response('OK'); | |
}); | |
$app->boot(); | |
$h = \Monolog\ErrorHandler::register($app['logger'], false); | |
$h->registerErrorHandler([], true, E_ALL, false); | |
$app->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment