示例#1
0
 /**
  * testIsValidLogLevel
  *
  * Tests if Logger::isValidLogLevel returns $expectedReturnValue for $level
  *
  * @dataProvider    provideTestIsValidLogLevel
  * @access public
  * @param  string   $level
  * @param  boolean  $expectedReturnValue
  * @return void
  **/
 public function testIsValidLogLevel($level, $expectedReturnValue)
 {
     $this->assertSame($expectedReturnValue, Logger::isValidLogLevel($level));
 }
 /**
  * log
  *
  * Logs a $message of $level to this log adapter (with a certain $context).
  * Returns true when logging is successful or when success cannot be determined.
  *
  * @access public
  * @param  string   $level
  * @param  string   $message
  * @param  array    $context
  * @return boolean
  * @throws InvalidArgumentException
  **/
 public function log($level, $message, array $context = array())
 {
     if (!Logger::isValidLogLevel($level)) {
         throw new InvalidArgumentException("'" . $level . "' is not a valid LogLevel.");
     }
     if ($this->isLoggingForChannelAndLogLevel($level, $context)) {
         return $this->write($level, $message, $context);
     }
     return false;
 }