function rules_log

Log a message to the rules logger.

Parameters

$msg: The message to log.

array $args: An array of placeholder arguments as used by t().

$priority: A priority as defined by the RulesLog class.

RulesPlugin $element: (optional) The RulesElement causing the log entry.

bool $scope: (optional) This may be used to denote the beginning (TRUE) or the end (FALSE) of a new execution scope.

26 calls to rules_log()
Rule::evaluate in includes/rules.plugins.inc
Evaluate, whereas by default new vars are visible in the parent's scope.
Rule::fire in includes/rules.plugins.inc
Fires the rule, i.e. evaluates the rule without checking its conditions.
RulesAbstractPlugin::evaluate in includes/rules.core.inc
Evaluate the element on a given rules evaluation state.
RulesAbstractPlugin::executeByArgs in includes/rules.core.inc
Execute the configuration by passing arguments in a single array.
RulesAction::executeCallback in includes/rules.plugins.inc
Execute the callback and update/save data as specified by the action.

... See full list

2 string references to 'rules_log'
rules_debug_log_pre_render in ./rules.module
Pre-render callback for the debug log, which renders and then clears it.
rules_page_build in ./rules.module
Implements hook_page_build() to add the rules debug log to the page bottom.

File

./rules.module, line 225

Code

function rules_log($msg, $args = array(), $priority = RulesLog::INFO, RulesPlugin $element = NULL, $scope = NULL) {
  static $logger, $settings;
  // Statically cache the variable settings as this is called very often.
  if (!isset($settings)) {
    $settings['rules_log_errors'] = variable_get('rules_log_errors', RulesLog::WARN);
    $settings['rules_debug_log'] = variable_get('rules_debug_log', FALSE);
    $settings['rules_debug'] = variable_get('rules_debug', 0);
  }
  if ($priority >= $settings['rules_log_errors']) {
    $link = NULL;
    if (isset($element) && isset($element->root()->name)) {
      $link = l(t('edit configuration'), RulesPluginUI::path($element->root()->name, 'edit', $element));
    }
    // Disabled rules invocation to avoid an endless loop when using
    // watchdog - which would trigger a rules event.
    rules_event_invocation_enabled(FALSE);
    watchdog('rules', $msg, $args, $priority == RulesLog::WARN ? WATCHDOG_WARNING : WATCHDOG_ERROR, $link);
    rules_event_invocation_enabled(TRUE);
  }
  // Do nothing in case debugging is totally disabled.
  if (!$settings['rules_debug_log'] && !$settings['rules_debug']) {
    return;
  }
  if (!isset($logger)) {
    $logger = RulesLog::logger();
  }
  $path = isset($element) && isset($element->root()->name) ? RulesPluginUI::path($element->root()->name, 'edit', $element) : NULL;
  $logger->log($msg, $args, $priority, $scope, $path);
}