diff --git a/modules/system.eval.inc b/modules/system.eval.inc index 70a5f51..822aa13 100644 --- a/modules/system.eval.inc +++ b/modules/system.eval.inc @@ -16,6 +16,14 @@ function rules_action_drupal_message($message, $status, $repeat) { } /** + * Action: Create a watchdog entry. + */ +function rules_action_watchdog($type, $message, $severity = WATCHDOG_NOTICE, $link = NULL) { + watchdog($type, $message, array(), $severity, $link); +} + + +/** * Action: Page redirect. * * @see rules_page_build() diff --git a/modules/system.rules.inc b/modules/system.rules.inc index fcd4f80..bf38984 100644 --- a/modules/system.rules.inc +++ b/modules/system.rules.inc @@ -124,6 +124,33 @@ function rules_system_action_info() { 'base' => 'rules_action_drupal_message', 'access callback' => 'rules_system_integration_access', ), + 'watchdog' => array( + 'label' => t('Log a system message'), + 'group' => t('System'), + 'parameter' => array( + 'type' => array( + 'type' => 'text', + 'label' => t('Type'), + 'description' => t('The category to which this message belongs. Can be any string, but the general practice is to use the name of the module creating the message.'), + ), + 'message' => array( + 'type' => 'text', + 'label' => ('Message'), + 'description' => ('The message to store in the log.'), + ), + 'severity' => array( + 'type' => 'integer', + 'label' => t('Severity'), + 'options list' => 'watchdog_severity_levels', + 'optional' => TRUE, + ), + 'link' => array( + 'type' => 'text', + 'label' => t('Link'), + 'description' => t('An HTML formatted link to associate with the message.'), + 'optional' => TRUE, + ), + ), + 'base' => 'rules_action_watchdog', + 'access callback' => 'rules_system_integration_access', + ), 'redirect' => array( 'label' => t('Page redirect'), 'group' => t('System'),