Index: www/modules/syslog/syslog.module
===================================================================
--- www/modules/syslog/syslog.module	(revision 33691)
+++ www/modules/syslog/syslog.module	(working copy)
@@ -46,6 +46,12 @@
     '#description'   => t('Select the syslog facility code under which Drupal\'s messages should be sent. On UNIX/Linux systems, Drupal can flag its messages with the code LOG_LOCAL0 through LOG_LOCAL7; for Microsoft Windows, all messages are flagged with the code LOG_USER. Depending on the system configuration, syslog and other logging tools use this code to identify or filter Drupal messages from within the entire system log. For more information on syslog, see <a href="@syslog_help">Syslog help</a>.', array(
       '@syslog_help' => url('admin/help/syslog'))),
   );
+  $form['syslog_format'] = array(
+    '#type'          => 'textarea',
+    '#title'         => t('Format'),
+    '#default_value' => variable_get('syslog_format', '%base_url|%timestamp|%type|%ip|%request_uri|%referer|%uid|%link|%message'),
+    '#description'   => t("Specify the format of the syslog message. Available variables are: <code>%base_url</code> - base url of the site; <code>%timestamp</code> - Unix timestamp of the message; <code>%type</code> - the category to which this message belongs; <code>%ip</code> - IP address of the user triggering the message; <code>%request_uri</code> - the requested URI; <code>%referer</code> - HTTP Referer if available; <code>%uid</code> - user's id; <code>%link</code> - a link to associate with the message; <code>%message</code> - the message to store in the log."),
+  );
   return system_settings_form($form);
 }
 
@@ -69,6 +75,7 @@
 }
 
 function syslog_watchdog($entry) {
+  global $base_url;
   static $log_init = FALSE;
 
   if (!$log_init) {
@@ -76,34 +83,22 @@
     openlog('drupal', LOG_NDELAY, variable_get('syslog_facility', DEFAULT_SYSLOG_FACILITY));
   }
 
-  syslog($entry['severity'], theme('syslog_format', $entry));
-}
+  $syslog_format = variable_get('syslog_format', '%base_url|%timestamp|%type|%ip|%request_uri|%referer|%uid|%link|%message');
+  $log = strtr($syslog_format, array(
+    '%base_url'    => $base_url,
+    '%timestamp'   => $entry['timestamp'],
+    '%type'        => $entry['type'],
+    '%ip'          => $entry['ip'],
+    '%request_uri' => $entry['request_uri'],
+    '%referer'     => $entry['referer'],
+    '%uid'         => $entry['user']->uid,
+    '%link'        => strip_tags($entry['link']),
+    '%message'     => strip_tags(is_null($entry['variables']) ?
+      $entry['message'] :
+      strtr($entry['message'], $entry['variables'])),
+  ));
 
-function syslog_theme() {
-  return array(
-    'syslog_format' => array(
-      'arguments' => array('entry' => NULL),
-    ),
-  );
-}
+  drupal_alter('syslog_log', $log, $entry);
 
-/**
- * Format a system log entry.
- *
- * @ingroup themeable
- */
-function theme_syslog_format($entry) {
-  global $base_url;
-
-  $message  = $base_url;
-  $message .= '|'. $entry['timestamp'];
-  $message .= '|'. $entry['type'];
-  $message .= '|'. $entry['ip'];
-  $message .= '|'. $entry['request_uri'];
-  $message .= '|'. $entry['referer'];
-  $message .= '|'. $entry['user']->uid;
-  $message .= '|'. strip_tags($entry['link']);
-  $message .= '|'. strip_tags(is_null($entry['variables']) ? $entry['message'] : strtr($entry['message'], $entry['variables']));
-
-  return $message;
+  syslog($entry['severity'], $log);
 }
