Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $message = $this->getContextValue('message');
     if (empty($message)) {
         $message = 'action called';
     }
     $this->logger->info($message);
 }
 /**
  * Tests LoggerChannel::log().
  *
  * @param string $psr3_message_level
  *   Expected PSR3 log level.
  * @param int $rfc_message_level
  *   Expected RFC 5424 log level.
  * @param int $debug_log
  *   Is logging enabled.
  * @param string $psr3_log_error_level
  *   Allowed PSR3 log level.
  * @param int $expect_log
  *   Amount of logs to be created.
  * @param string $message
  *   Log message.
  *
  * @dataProvider providerTestLog
  *
  * @covers ::log
  */
 public function testLog($psr3_message_level, $rfc_message_level, $debug_log, $psr3_log_error_level, $expect_log, $message)
 {
     $config = $this->getConfigFactoryStub(['rules.settings' => ['debug_log' => $debug_log, 'log_errors' => $psr3_log_error_level]]);
     $channel = new RulesLoggerChannel($config);
     $logger = $this->prophesize(LoggerInterface::class);
     $logger->log($rfc_message_level, $message, Argument::type('array'))->shouldBeCalledTimes($expect_log);
     $channel->addLogger($logger->reveal());
     $channel->log($psr3_message_level, $message);
 }
Esempio n. 3
0
 /**
  * Checks if particular message is in the log with given delta.
  *
  * @param string $message
  *   Log message.
  * @param int $log_item_index
  *   Log item's index in log entries stack.
  */
 protected function assertRulesLogEntryExists($message, $log_item_index = 0)
 {
     // Test that the action has logged something.
     $logs = $this->logger->getLogs();
     $this->assertEqual($logs[$log_item_index]['message'], $message);
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $this->logger->info('action called');
 }