1
0
Fork 0

rework the logging interface

This commit is contained in:
Mike Macgirvin 2010-10-26 22:09:13 -07:00
commit 2028e1695c
7 changed files with 47 additions and 67 deletions

View file

@ -58,8 +58,11 @@ class dba {
}
}
else {
if(($result === false) && (file_exists('dbfail.out')))
file_put_contents('dbfail.out', printable($sql) . ' returned false' . "\n", FILE_APPEND);
if($result === false) {
logger('dba: ' . printable($sql) . ' returned false.');
if(file_exists('dbfail.out'))
file_put_contents('dbfail.out', printable($sql) . ' returned false' . "\n", FILE_APPEND);
}
}
if(($result === true) || ($result === false))

View file

@ -923,8 +923,7 @@ function consume_feed($xml,$importer,$contact, &$hub) {
$datarray = get_atom_elements($feed,$item);
if($datarray['verb'] === ACTIVITY_FOLLOW) {
if($debugging)
file_put_contents('salmon.out',"\n" . 'New follower.' . "\n", FILE_APPEND);
logger('consume-feed: New follower');
new_follower($importer,$contact,$datarray,$item);
return;
}

View file

@ -343,10 +343,7 @@
continue;
$params = 'hub.mode=publish&hub.url=' . urlencode($a->get_baseurl() . '/dfrn_poll/' . $owner['nickname'] );
post_url($h,$params);
if($debugging) {
file_put_contents('pubsub.out', "\n\n" . "Pinged hub " . $h . ' at '
. datetime_convert() . "\n" . "Hub returned " . $a->get_curl_code() . "\n\n" , FILE_APPEND);
}
logger('pubsub: publish: ' . $h . ' returned ' . $a->get_curl_code());
if(count($hubs) > 1)
sleep(7); // try and avoid multiple hubs responding at precisely the same time
}

View file

@ -29,9 +29,7 @@ function base64url_decode($s) {
function get_salmon_key($uri,$keyhash) {
$ret = array();
$debugging = get_config('system','debugging');
if($debugging)
file_put_contents('salmon.out', "\n" . 'Fetch key' . "\n", FILE_APPEND);
logger('Fetching salmon key');
$arr = lrdd($uri);
@ -62,8 +60,8 @@ function get_salmon_key($uri,$keyhash) {
}
}
if($debugging)
file_put_contents('salmon.out', "\n" . 'Key located: ' . print_r($ret,true) . "\n", FILE_APPEND);
logger('Key located: ' . print_r($ret,true));
if(count($ret) == 1) {
@ -90,6 +88,7 @@ function get_salmon_key($uri,$keyhash) {
function slapper($owner,$contact,$slap) {
logger('slapper called. Data: ' . $slap);
// does contact have a salmon endpoint?
@ -180,7 +179,7 @@ EOT;
$return_code = trim($a->get_curl_code());
}
logger('slapper returned ' . $return_code);
return;
}