Improved log levels

This commit is contained in:
Michael 2022-05-14 11:18:48 +00:00
parent 43dbd1c396
commit fbdb73cdd6

View File

@ -66,7 +66,7 @@ class APDelivery
return;
}
Logger::info('Invoked', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]);
Logger::debug('Invoked', ['cmd' => $cmd, 'inbox' => $inbox, 'id' => $item_id, 'uri-id' => $uri_id, 'uid' => $uid]);
if (empty($uri_id)) {
$result = self::deliver($inbox);
@ -99,7 +99,7 @@ class APDelivery
if ($result['timeout']) {
// In a timeout situation we assume that every delivery to that inbox will time out.
// So we set the flag and try all deliveries at a later time.
Logger::debug('Inbox delivery has a time out', ['inbox' => $inbox]);
Logger::info('Inbox delivery has a time out', ['inbox' => $inbox]);
$timeout = true;
}
}
@ -118,7 +118,7 @@ class APDelivery
if (empty($item_id) && !empty($uri_id) && !empty($uid)) {
$item = Post::selectFirst(['id', 'parent', 'origin'], ['uri-id' => $uri_id, 'uid' => [$uid, 0]], ['order' => ['uid' => true]]);
if (empty($item['id'])) {
Logger::debug('Item not found, removing delivery', ['uri-id' => $uri_id, 'uid' => $uid, 'cmd' => $cmd, 'inbox' => $inbox]);
Logger::notice('Item not found, removing delivery', ['uri-id' => $uri_id, 'uid' => $uid, 'cmd' => $cmd, 'inbox' => $inbox]);
Post\Delivery::remove($uri_id, $inbox);
return true;
} else {
@ -153,6 +153,7 @@ class APDelivery
$success = $response->isSuccess();
$timeout = $response->isTimeout();
if (!$success) {
if ($response->getReturnCode() == 500) {
$xrd_timeout = DI::config()->get('system', 'xrd_timeout');
if (!$timeout && $xrd_timeout && ($runtime > $xrd_timeout)) {
$timeout = true;
@ -161,8 +162,9 @@ class APDelivery
if (!$timeout && $curl_timeout && ($runtime > $curl_timeout)) {
$timeout = true;
}
}
Logger::debug('Delivery failed', ['retcode' => $response->getReturnCode(), 'timeout' => $timeout, 'runtime' => round($runtime, 3), 'uri-id' => $uri_id, 'uid' => $uid, 'item_id' => $item_id, 'cmd' => $cmd, 'inbox' => $inbox]);
Logger::info('Delivery failed', ['retcode' => $response->getReturnCode(), 'timeout' => $timeout, 'runtime' => round($runtime, 3), 'uri-id' => $uri_id, 'uid' => $uid, 'item_id' => $item_id, 'cmd' => $cmd, 'inbox' => $inbox]);
}
if ($uri_id) {
if ($success) {
@ -176,7 +178,7 @@ class APDelivery
self::setSuccess($receivers, $success);
Logger::info('Delivered', ['uri-id' => $uri_id, 'uid' => $uid, 'item_id' => $item_id, 'cmd' => $cmd, 'inbox' => $inbox, 'success' => $success]);
Logger::debug('Delivered', ['uri-id' => $uri_id, 'uid' => $uid, 'item_id' => $item_id, 'cmd' => $cmd, 'inbox' => $inbox, 'success' => $success]);
if ($success && in_array($cmd, [Delivery::POST])) {
Post\DeliveryData::incrementQueueDone($uri_id, Post\DeliveryData::ACTIVITYPUB);