예제 #1
0
 /**
  * Helper function to log a message at the warn log level.
  * @param string $message the message to log.
  * @param array  $extras  [optional] the array of extra variables to pass to this
  * single log entry. to this single log entry to this single log entry.
  * @return void
  */
 public function warn($message, $extras = array())
 {
     $this->log(Level::warn(), $message, $extras);
 }
예제 #2
0
 /**
  * Mainly tests that we can set a logger to a threshold.
  * Also confirms the functionality of disabling propogation and setting
  * level and 'enablePropogation' in the configuration array.
  */
 public function testSetLoggerThreshold()
 {
     //clear any previous configuration (as hierarchy is stored between calls)
     Logger::getHierarchy()->clear();
     $logger = Logger::getLogger('test_logger', array('enablePropogation' => false, 'level' => Level::warn(), 'writers' => array('EchoWriter' => array())));
     $tMessage = 'Tester Message';
     //attempt an info message, should be no output.
     ob_start();
     $logger->info($tMessage);
     $message = ob_get_clean();
     $this->assertEquals('', $message);
     //attempt a fatal message, should succeed.
     ob_start();
     $logger->fatal($tMessage);
     $message = ob_get_clean();
     $this->assertNotEquals('', $message);
 }