mirror of
https://github.com/friendica/friendica
synced 2025-04-24 01:10:11 +00:00
Log function
implement log() function.
This commit is contained in:
parent
d6d593d724
commit
14fde5dc9b
122 changed files with 1280 additions and 1161 deletions
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -45,7 +46,7 @@ class PushSubscriber
|
|||
$priority = $default_priority;
|
||||
}
|
||||
|
||||
logger('Publish feed to ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' with priority ' . $priority, LOGGER_DEBUG);
|
||||
Logger::log('Publish feed to ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' with priority ' . $priority, LOGGER_DEBUG);
|
||||
Worker::add($priority, 'PubSubPublish', (int)$subscriber['id']);
|
||||
}
|
||||
|
||||
|
@ -88,9 +89,9 @@ class PushSubscriber
|
|||
'secret' => $hub_secret];
|
||||
DBA::insert('push_subscriber', $fields);
|
||||
|
||||
logger("Successfully subscribed [$hub_callback] for $nick");
|
||||
Logger::log("Successfully subscribed [$hub_callback] for $nick");
|
||||
} else {
|
||||
logger("Successfully unsubscribed [$hub_callback] for $nick");
|
||||
Logger::log("Successfully unsubscribed [$hub_callback] for $nick");
|
||||
// we do nothing here, since the row was already deleted
|
||||
}
|
||||
}
|
||||
|
@ -115,10 +116,10 @@ class PushSubscriber
|
|||
|
||||
if ($days > 60) {
|
||||
DBA::update('push_subscriber', ['push' => -1, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
|
||||
logger('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', LOGGER_DEBUG);
|
||||
Logger::log('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', LOGGER_DEBUG);
|
||||
} else {
|
||||
DBA::update('push_subscriber', ['push' => 0, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
|
||||
logger('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', LOGGER_DEBUG);
|
||||
Logger::log('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', LOGGER_DEBUG);
|
||||
}
|
||||
} else {
|
||||
// Calculate the delay until the next trial
|
||||
|
@ -128,7 +129,7 @@ class PushSubscriber
|
|||
$retrial = $retrial + 1;
|
||||
|
||||
DBA::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
|
||||
logger('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, LOGGER_DEBUG);
|
||||
Logger::log('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,6 +149,6 @@ class PushSubscriber
|
|||
// set last_update to the 'created' date of the last item, and reset push=0
|
||||
$fields = ['push' => 0, 'next_try' => DBA::NULL_DATETIME, 'last_update' => $last_update];
|
||||
DBA::update('push_subscriber', $fields, ['id' => $id]);
|
||||
logger('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', LOGGER_DEBUG);
|
||||
Logger::log('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue