function theme_filelog_format in File Log 6
Same name and namespace in other branches
- 6.2 filelog.module \theme_filelog_format()
- 7 filelog.module \theme_filelog_format()
Format a file log entry.
1 theme call to theme_filelog_format()
- filelog_watchdog in ./
filelog.module - Implementation of hook_watchdog().
File
- ./
filelog.module, line 68 - Writes logging messages into files.
Code
function theme_filelog_format($entry) {
global $base_url;
$f = _filelog_get_conf();
//shortcuts
$sep =& $f['field_separator'];
$prefix =& $f['field_prefix'];
$suffix =& $f['field_suffix'];
$message = '';
if ($f['log_base_url']) {
$message .= $prefix . $base_url . $suffix . $sep;
}
if ($f['date_format']) {
if (in_array($f['date_format'], array(
'small',
'large',
'medium',
))) {
$entry['timestamp'] = format_date($entry['timestamp'], $f['date_format'], '', NULL, 'en');
}
else {
$entry['timestamp'] = format_date($entry['timestamp'], 'custom', $f['date_format'], NULL, 'en');
}
}
$message .= $prefix . $entry['timestamp'] . $suffix;
if ($f['grouped_severity_in_name'] || !$f['severity_in_name']) {
$message .= $sep . $prefix . ($f['decode_severity'] ? _filelog_decode_severity($entry['severity']) : $entry['severity']) . $suffix;
}
if (!$f['type_in_name']) {
$message .= $sep . $prefix . $entry['type'] . $suffix;
}
if ($f['log_username']) {
$message .= $sep . $prefix . ($entry['user']->uid ? $entry['user']->name : variable_get('anonymous', t('Anonymous'))) . $suffix;
}
else {
$message .= $sep . $prefix . $entry['user']->uid . $suffix;
}
$message .= $sep . $prefix . $entry['ip'] . $suffix;
$message .= $sep . $prefix . $entry['request_uri'] . $suffix;
$message .= $sep . $prefix . $entry['referer'] . $suffix;
$message .= $sep . $prefix . ($f['skip_strip_tags'] ? $entry['link'] : strip_tags($entry['link'])) . $suffix;
if (is_object($entry['variables'])) {
$entry['variables'] = (array) $entry['variables'];
}
else {
if (!is_array($entry['variables'])) {
$entry['variables'] = array();
}
}
if (!$f['wrap_message']) {
$prefix = $suffix = '';
}
$text = is_null($entry['variables']) ? $entry['message'] : strtr($entry['message'], $entry['variables']);
$message .= $sep . $prefix . ($f['skip_strip_tags'] ? $text : strip_tags($text)) . $suffix;
return $message;
}