Esempio n. 1
0
 /**
  * @param Application $app
  * @return void
  */
 protected function registerLogger(Application $app)
 {
     if (!$app->offsetExists('monolog.name')) {
         return;
     }
     $app->register(new MonologServiceProvider(), array('monolog.name' => $app['monolog.name'], 'monolog.level' => $app['monolog.level'], 'monolog.logfile' => $app['monolog.logfile']));
     $this->register(new ExtendedLoggerServiceProvider());
 }
Esempio n. 2
0
 /**
  * @dataProvider logExecTimeDataProvider
  */
 public function testLogExecTimeShouldLogAtDifferentLevelsDependingOnExecTime($thresholds, $methodToCheck)
 {
     $app = new Application(array_merge(array('monolog.logfile' => false, 'timer.start' => microtime(true)), $thresholds));
     $app->register(new MonologServiceProvider(), array('monolog.handler' => new TestHandler()));
     usleep(1001);
     $request = new Request(array(), array(), array(), array(), array(), array('QUERY_STRING' => 'foo=bar'));
     $app->logExecTime($request);
     $records = $app['monolog.handler']->getRecords();
     $this->assertTrue($app['monolog.handler']->{$methodToCheck}());
     $this->assertEquals('foo=bar', $records[0]['context']['query']);
 }
Esempio n. 3
0
 public function __construct(array $values = array())
 {
     if ($values['debug']) {
         Debug::enable();
     }
     parent::__construct($values);
     $this->registerLogger($this);
     $this->registerTwig($this);
 }
Esempio n. 4
0
 public function __construct($mode = null)
 {
     // Create Chrome logger bridge
     $this->initLogger();
     if (is_null($mode)) {
         $mode = 'sandbox';
     }
     //
     // Load App configs
     $values = $this->loadConfigs($mode);
     //
     // Enable debug
     if ($values['debug']) {
         Debug::enable();
         $this->logger->setMode(true);
     }
     \debug::info("Debug mode is " . var_export($values['debug'], true));
     parent::__construct($values);
     $this->registerLogger($this);
     $this->registerTwig($this);
     $this->registerBaseService(self::$mode);
 }
Esempio n. 5
0
 public function __construct(array $values = array())
 {
     parent::__construct($values);
     $this->registerLogger($this);
     $this->registerTwig($this);
 }