--- syslog.module	2009-12-14 23:31:51.640625000 +0100
+++ syslog.module	2009-12-14 23:35:02.093750000 +0100
@@ -47,6 +47,13 @@ function syslog_form_system_logging_sett
       '#description'   => t('Depending on the system configuration, Syslog and other logging tools use this code to identify or filter messages from within the entire system log.') . $help,
      );
     $form['buttons']['#weight'] = 1;
+
+    $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."),
+    );
   }
 }
 
@@ -80,35 +87,22 @@ function syslog_watchdog(array $log_entr
     openlog('drupal', LOG_NDELAY, variable_get('syslog_facility', $default_facility));
   }
 
-  syslog($log_entry['severity'], theme('syslog_format', array('entry' => $log_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(
-      'variables' => array('entry' => NULL),
-    ),
-  );
-}
-
-/**
- * Format a system log entry.
- *
- * @ingroup themeable
- */
-function theme_syslog_format($variables) {
-  $entry = $variables['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']));
+  drupal_alter('syslog_log', $log, $entry);
 
-  return $message;
+  syslog($entry['severity'], $log);
 }
