You are here

function theme_emaillog_format in Logging and alerts 6

Same name and namespace in other branches
  1. 7 emaillog/emaillog.module \theme_emaillog_format()
1 theme call to theme_emaillog_format()
emaillog_mail in emaillog/emaillog.module
Implementation of hook_mail().

File

emaillog/emaillog.module, line 77
Sends logs and alerts to email addresses.

Code

function theme_emaillog_format($log_msg = array()) {
  global $base_url;
  $severity_levels = watchdog_severity_levels();
  $message = "\nSite:         @base_url";
  $message .= "\nSeverity:     (@severity) @severity_desc";
  $message .= "\nTimestamp:    @timestamp";
  $message .= "\nType:         @type";
  $message .= "\nIP Address:   @ip";
  $message .= "\nRequest URI:  @request_uri";
  $message .= "\nReferrer URI: @referer_uri";
  $message .= "\nUser:         (@uid) @name";
  $message .= "\nLink:         @link";
  $message .= "\nMessage:      \n\n@message";
  $message = t($message, array(
    '@base_url' => $base_url,
    '@severity' => $log_msg['severity'],
    '@severity_desc' => drupal_ucfirst($severity_levels[$log_msg['severity']]),
    '@timestamp' => format_date($log_msg['timestamp']),
    '@type' => $log_msg['type'],
    '@ip' => $log_msg['ip'],
    '@request_uri' => $log_msg['request_uri'],
    '@referer_uri' => $log_msg['referer'],
    '@uid' => $log_msg['user']->uid,
    '@name' => !empty($log_msg['user']->name) ? $log_msg['user']->name : variable_get('anonymous', t('Anonymous')),
    '@link' => strip_tags($log_msg['link']),
    '@message' => strip_tags(t($log_msg['message'], $log_msg['variables'])),
  ));
  return $message;
}