Improved logger text

This commit is contained in:
Michael 2018-11-05 20:35:17 +00:00
parent 59d8cae805
commit 3b565e80b6

View file

@ -58,7 +58,7 @@ class Notifier
{ {
$a = BaseObject::getApp(); $a = BaseObject::getApp();
Logger::log('notifier: invoked: '.$cmd.': '.$item_id, Logger::DEBUG); Logger::log('Invoked: ' . $cmd . ': ' . $item_id, Logger::DEBUG);
$top_level = false; $top_level = false;
$recipients = []; $recipients = [];
@ -148,7 +148,7 @@ class Notifier
} }
if ((count($items) == 1) && ($items[0]['id'] === $target_item['id']) && ($items[0]['uri'] === $items[0]['parent-uri'])) { if ((count($items) == 1) && ($items[0]['id'] === $target_item['id']) && ($items[0]['uri'] === $items[0]['parent-uri'])) {
Logger::log('notifier: top level post'); Logger::log('Top level post');
$top_level = true; $top_level = true;
} }
} }
@ -184,7 +184,7 @@ class Notifier
$condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]]; $condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]];
$thr_parent = Item::selectFirst($fields, $condition); $thr_parent = Item::selectFirst($fields, $condition);
Logger::log('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent['network'], Logger::DEBUG); Logger::log('GUID: ' . $target_item["guid"] . ': Parent is ' . $parent['network'] . '. Thread parent is ' . $thr_parent['network'], Logger::DEBUG);
// This is IMPORTANT!!!! // This is IMPORTANT!!!!
@ -247,7 +247,7 @@ class Notifier
$recipients = [$parent['contact-id']]; $recipients = [$parent['contact-id']];
$recipients_followup = [$parent['contact-id']]; $recipients_followup = [$parent['contact-id']];
Logger::log('notifier: followup ' . $target_item['guid'] . ' to ' . $parent['contact-id'], Logger::DEBUG); Logger::log('Followup ' . $target_item['guid'] . ' to ' . $parent['contact-id'], Logger::DEBUG);
//if (!$target_item['private'] && $target_item['wall'] && //if (!$target_item['private'] && $target_item['wall'] &&
if (!$target_item['private'] && if (!$target_item['private'] &&
@ -277,16 +277,16 @@ class Notifier
$push_notify = false; $push_notify = false;
} }
Logger::log("Notify ".$target_item["guid"]." via PuSH: ".($push_notify?"Yes":"No"), Logger::DEBUG); Logger::log('Notify ' . $target_item["guid"] .' via PuSH: ' . ($push_notify ? "Yes":"No"), Logger::DEBUG);
} else { } else {
$followup = false; $followup = false;
Logger::log('Distributing directly '.$target_item["guid"], Logger::DEBUG); Logger::log('Distributing directly ' . $target_item["guid"], Logger::DEBUG);
// don't send deletions onward for other people's stuff // don't send deletions onward for other people's stuff
if ($target_item['deleted'] && !intval($target_item['wall'])) { if ($target_item['deleted'] && !intval($target_item['wall'])) {
Logger::log('notifier: ignoring delete notification for non-wall item'); Logger::log('Ignoring delete notification for non-wall item');
return; return;
} }
@ -325,7 +325,7 @@ class Notifier
} }
if (count($url_recipients)) { if (count($url_recipients)) {
Logger::log('notifier: '.$target_item["guid"].' url_recipients ' . print_r($url_recipients,true)); Logger::log('Deliver ' . $target_item["guid"] . ' to _recipients ' . json_decode($url_recipients));
} }
$recipients = array_unique(array_merge($recipients, $allow_people, $allow_groups)); $recipients = array_unique(array_merge($recipients, $allow_people, $allow_groups));
@ -444,11 +444,9 @@ class Notifier
$r = array_merge($r2, $r1); $r = array_merge($r2, $r1);
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
Logger::log('pubdeliver '.$target_item["guid"].': '.print_r($r,true), Logger::DEBUG);
foreach ($r as $rr) { foreach ($r as $rr) {
$conversants[] = $rr['id']; $conversants[] = $rr['id'];
Logger::log('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]); Logger::log('Public delivery of item ' . $target_item["guid"] . ' (' . $item_id . ') to ' . json_encode($rr), Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Delivery', $cmd, $item_id, (int)$rr['id']); 'Delivery', $cmd, $item_id, (int)$rr['id']);
} }
@ -462,17 +460,17 @@ class Notifier
foreach ($contacts as $contact) { foreach ($contacts as $contact) {
// Don't deliver to Diaspora if it already had been done as batch delivery // Don't deliver to Diaspora if it already had been done as batch delivery
if (($contact['network'] == Protocol::DIASPORA) && $batch_delivery) { if (($contact['network'] == Protocol::DIASPORA) && $batch_delivery) {
Logger::log('Already delivered id ' . $item_id . ' via batch to ' . json_encode($contact), Logger::DEBUG);
continue; continue;
} }
// Don't deliver to folks who have already been delivered to // Don't deliver to folks who have already been delivered to
if (in_array($contact['id'], $conversants)) { if (in_array($contact['id'], $conversants)) {
Logger::log('notifier: already delivered id=' . $rr['id']); Logger::log('Already delivered id ' . $item_id. ' to ' . json_encode($contact), Logger::DEBUG);
continue; continue;
} }
Logger::log("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], Logger::DEBUG); Logger::log('Delivery of item ' . $item_id . ' to ' . json_encode($contact), Logger::DEBUG);
Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true], Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
'Delivery', $cmd, $item_id, (int)$contact['id']); 'Delivery', $cmd, $item_id, (int)$contact['id']);
} }
@ -484,7 +482,7 @@ class Notifier
$slap = OStatus::salmon($target_item, $owner); $slap = OStatus::salmon($target_item, $owner);
foreach ($url_recipients as $url) { foreach ($url_recipients as $url) {
if ($url) { if ($url) {
Logger::log('notifier: urldelivery: ' . $url); Logger::log('Salmon delivery of item ' . $item_id . ' to ' . $url);
$deliver_status = Salmon::slapper($owner, $url, $slap); $deliver_status = Salmon::slapper($owner, $url, $slap);
/// @TODO Redeliver/queue these items on failure, though there is no contact record /// @TODO Redeliver/queue these items on failure, though there is no contact record
} }
@ -499,7 +497,7 @@ class Notifier
PushSubscriber::publishFeed($owner['uid'], $a->queue['priority']); PushSubscriber::publishFeed($owner['uid'], $a->queue['priority']);
} }
Logger::log('notifier: calling hooks for ' . $cmd . ' ' . $item_id, Logger::DEBUG); Logger::log('Calling hooks for ' . $cmd . ' ' . $item_id, Logger::DEBUG);
if ($normal_mode) { if ($normal_mode) {
Hook::fork($a->queue['priority'], 'notifier_normal', $target_item); Hook::fork($a->queue['priority'], 'notifier_normal', $target_item);