Permalink
Browse files

get logging working

  • Loading branch information...
jonmountjoy committed May 28, 2014
1 parent dc35cc7 commit 83ac461079032665776712bbb16d853f138de5f2
Showing with 15 additions and 19 deletions.
  1. +8 −8 composer.json
  2. +7 −11 web/index.php
View
@@ -1,10 +1,10 @@
{
"require" : {
"silex/silex": "~1.1",
"monolog/monolog": "~1.7",
"twig/twig": "~1.0"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
}
"require" : {
"silex/silex": "~1.1",
"monolog/monolog": "~1.7",
"twig/twig": "~1.0"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
}
}
View
@@ -3,10 +3,15 @@
require('../vendor/autoload.php');
$app = new Silex\Application();
$app['debug'] = true;
//$app['debug'] = true;
$app->register(new Silex\Provider\MonologServiceProvider(), array(
'monolog.logfile' => 'php://stderr',
));
// ... definitions
$app->get('/', function () use ($app) {
$app['monolog']->addDebug('Testing the Monolog logging.');
return 'Hello';
});
@@ -16,7 +21,7 @@
// ... definitions
$app->get('/{name}', function ($name) use ($app) {
return 'Hello '.$app->escape($name);
return 'Hello '.$app->escape($name);
});
@@ -25,15 +30,6 @@
?>
<!--
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
// create a log channel to STDERR
$log = new Logger('name');
$log->pushHandler(new StreamHandler('php://stderr', Logger::WARNING));
// add records to the log
$log->addWarning("This message will be logged!");
echo "Hello World!";

0 comments on commit 83ac461

Please sign in to comment.