function _spam_log_trace in Spam 5.3
Same name and namespace in other branches
- 6 spam.module \_spam_log_trace()
Maintain a "trace id", allowing easy tracing of all spam actions for each page load. Only active if logging is set to verbose or higher.
1 call to _spam_log_trace()
- spam_log in ./
spam.module - Write to the spam_log database table.
File
- ./
spam.module, line 1780
Code
function _spam_log_trace($message, $type, $id) {
global $user;
static $trid = NULL;
if (!$trid && variable_get('spam_log_level', SPAM_DEBUG) >= SPAM_VERBOSE) {
$key = md5(microtime() . $message);
db_query("INSERT INTO {spam_log} (level, content_type, content_id, uid, function, message, hostname, timestamp) VALUES(%d, '%s', %d, %d, '%s', '%s', '%s', %d)", SPAM_VERBOSE, $type, $id, $user->uid, '_spam_log_trace', $key, $_SERVER['REMOTE_ADDR'], time());
$trid = db_result(db_query("SELECT lid FROM {spam_log} WHERE message = '%s'", $key));
if ($trid) {
db_query("UPDATE {spam_log} SET trid = %d, message = '%s' WHERE lid = %d", $trid, t('--'), $trid);
}
else {
$trid = 1;
spam_log(SPAM_LOG, '_spam_log_trace', t('Failed to obtain a valid trid.'));
}
}
return $trid;
}