コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function log($level, $message, array $context = [])
 {
     $this->logs[] = ['level' => $level, 'message' => $message, 'context' => $context];
     // Log message only if rules logging setting is enabled.
     if ($this->config->get('debug_log')) {
         if ($this->levelTranslation[$this->config->get('log_errors')] >= $this->levelTranslation[$level]) {
             parent::log($level, $message, $context);
         }
     }
 }
コード例 #2
0
ファイル: LoggerChannelTest.php プロジェクト: ddrozdik/dmaps
 /**
  * Tests LoggerChannel::addLoggers().
  *
  * @covers ::addLogger
  * @covers ::sortLoggers
  */
 public function testSortLoggers()
 {
     $channel = new LoggerChannel($this->randomMachineName());
     $index_order = '';
     for ($i = 0; $i < 4; $i++) {
         $logger = $this->getMock('Psr\\Log\\LoggerInterface');
         $logger->expects($this->once())->method('log')->will($this->returnCallback(function () use($i, &$index_order) {
             // Append the $i to the index order, so that we know the order that
             // loggers got called with.
             $index_order .= $i;
         }));
         $channel->addLogger($logger, $i);
     }
     $channel->log(rand(0, 7), $this->randomMachineName());
     // Ensure that the logger added in the end fired first.
     $this->assertEquals($index_order, '3210');
 }
コード例 #3
0
ファイル: CasHelper.php プロジェクト: anarshi/recap
 /**
  * Log information to the logger.
  *
  * Only log supplied information to the logger if module is configured to do
  * so, otherwise do nothing.
  *
  * @param string $message
  *   The message to log.
  */
 public function log($message)
 {
     if ($this->settings->get('debugging.log') == TRUE) {
         $this->loggerChannel->log(RfcLogLevel::DEBUG, $message);
     }
 }