Some more changed log levels

This commit is contained in:
Michael 2022-08-31 05:01:22 +00:00
parent 757a5c2de9
commit f7b85092b0
14 changed files with 30 additions and 24 deletions

View File

@ -678,14 +678,14 @@ function photos_post(App $a)
return; return;
} }
Logger::info('loading the contents of ' . $src); Logger::debug('loading contents', ['src' => $src]);
$imagedata = @file_get_contents($src); $imagedata = @file_get_contents($src);
$image = new Image($imagedata, $type); $image = new Image($imagedata, $type);
if (!$image->isValid()) { if (!$image->isValid()) {
Logger::info('unable to process image'); Logger::notice('unable to process image');
notice(DI::l10n()->t('Unable to process image.')); notice(DI::l10n()->t('Unable to process image.'));
@unlink($src); @unlink($src);
$foo = 0; $foo = 0;

View File

@ -156,7 +156,7 @@ class Tag
DBA::insert('post-tag', $fields, Database::INSERT_IGNORE); DBA::insert('post-tag', $fields, Database::INSERT_IGNORE);
Logger::info('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type, 'callstack' => System::callstack(8)]); Logger::debug('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type, 'callstack' => System::callstack(8)]);
} }
/** /**
@ -389,7 +389,7 @@ class Tag
return; return;
} }
Logger::info('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url, 'callstack' => System::callstack(8)]); Logger::debug('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url, 'callstack' => System::callstack(8)]);
DBA::delete('post-tag', ['uri-id' => $uriId, 'type' => $type, 'tid' => $tag['tid'], 'cid' => $tag['cid']]); DBA::delete('post-tag', ['uri-id' => $uriId, 'type' => $type, 'tid' => $tag['tid'], 'cid' => $tag['cid']]);
} }

View File

@ -237,7 +237,7 @@ class BaseApi extends BaseModule
$posts_day = Post::countThread($condition); $posts_day = Post::countThread($condition);
if ($posts_day > $throttle_day) { if ($posts_day > $throttle_day) {
Logger::info('Daily posting limit reached', ['uid' => $uid, 'posts' => $posts_day, 'limit' => $throttle_day]); Logger::notice('Daily posting limit reached', ['uid' => $uid, 'posts' => $posts_day, 'limit' => $throttle_day]);
$error = DI::l10n()->t('Too Many Requests'); $error = DI::l10n()->t('Too Many Requests');
$error_description = DI::l10n()->tt("Daily posting limit of %d post reached. The post was rejected.", "Daily posting limit of %d posts reached. The post was rejected.", $throttle_day); $error_description = DI::l10n()->tt("Daily posting limit of %d post reached. The post was rejected.", "Daily posting limit of %d posts reached. The post was rejected.", $throttle_day);
$errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description); $errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
@ -253,7 +253,7 @@ class BaseApi extends BaseModule
$posts_week = Post::countThread($condition); $posts_week = Post::countThread($condition);
if ($posts_week > $throttle_week) { if ($posts_week > $throttle_week) {
Logger::info('Weekly posting limit reached', ['uid' => $uid, 'posts' => $posts_week, 'limit' => $throttle_week]); Logger::notice('Weekly posting limit reached', ['uid' => $uid, 'posts' => $posts_week, 'limit' => $throttle_week]);
$error = DI::l10n()->t('Too Many Requests'); $error = DI::l10n()->t('Too Many Requests');
$error_description = DI::l10n()->tt("Weekly posting limit of %d post reached. The post was rejected.", "Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week); $error_description = DI::l10n()->tt("Weekly posting limit of %d post reached. The post was rejected.", "Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week);
$errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description); $errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
@ -269,7 +269,7 @@ class BaseApi extends BaseModule
$posts_month = Post::countThread($condition); $posts_month = Post::countThread($condition);
if ($posts_month > $throttle_month) { if ($posts_month > $throttle_month) {
Logger::info('Monthly posting limit reached', ['uid' => $uid, 'posts' => $posts_month, 'limit' => $throttle_month]); Logger::notice('Monthly posting limit reached', ['uid' => $uid, 'posts' => $posts_month, 'limit' => $throttle_month]);
$error = DI::l10n()->t('Too Many Requests'); $error = DI::l10n()->t('Too Many Requests');
$error_description = DI::l10n()->tt('Monthly posting limit of %d post reached. The post was rejected.', 'Monthly posting limit of %d posts reached. The post was rejected.', $throttle_month); $error_description = DI::l10n()->tt('Monthly posting limit of %d post reached. The post was rejected.', 'Monthly posting limit of %d posts reached. The post was rejected.', $throttle_month);
$errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description); $errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);

View File

@ -82,7 +82,7 @@ class Notify extends BaseModule
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found'); System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
} }
Logger::info('Importing post with the public envelope.', ['transmitter' => $msg['author']]); Logger::debug('Importing post with the public envelope.', ['transmitter' => $msg['author']]);
// Now we should be able to import it // Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer, Conversation::PARCEL_DIASPORA_DFRN, Conversation::RELAY); $ret = DFRN::import($msg['message'], $importer, Conversation::PARCEL_DIASPORA_DFRN, Conversation::RELAY);
@ -117,7 +117,7 @@ class Notify extends BaseModule
System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found'); System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
} }
Logger::info('Importing post with the private envelope.', ['transmitter' => $msg['author'], 'receiver' => $user['nickname']]); Logger::debug('Importing post with the private envelope.', ['transmitter' => $msg['author'], 'receiver' => $user['nickname']]);
// Now we should be able to import it // Now we should be able to import it
$ret = DFRN::import($msg['message'], $importer, Conversation::PARCEL_DIASPORA_DFRN, Conversation::PUSH); $ret = DFRN::import($msg['message'], $importer, Conversation::PARCEL_DIASPORA_DFRN, Conversation::PUSH);

View File

@ -49,7 +49,7 @@ class Revoke extends BaseApi
$condition = ['client_id' => $request['client_id'], 'client_secret' => $request['client_secret'], 'access_token' => $request['token']]; $condition = ['client_id' => $request['client_id'], 'client_secret' => $request['client_secret'], 'access_token' => $request['token']];
$token = DBA::selectFirst('application-view', ['id'], $condition); $token = DBA::selectFirst('application-view', ['id'], $condition);
if (empty($token['id'])) { if (empty($token['id'])) {
Logger::warning('Token not found', $condition); Logger::notice('Token not found', $condition);
DI::mstdnError()->Unauthorized(); DI::mstdnError()->Unauthorized();
} }

View File

@ -88,7 +88,7 @@ class Token extends BaseApi
$token = DBA::selectFirst('application-view', ['access_token', 'created_at'], $condition); $token = DBA::selectFirst('application-view', ['access_token', 'created_at'], $condition);
if (!DBA::isResult($token)) { if (!DBA::isResult($token)) {
Logger::warning('Token not found or outdated', $condition); Logger::notice('Token not found or outdated', $condition);
DI::mstdnError()->Unauthorized(); DI::mstdnError()->Unauthorized();
} }
} else { } else {

View File

@ -219,7 +219,7 @@ class Photo extends BaseModule
$rest = $total - ($fetch + $data + $checksum + $output); $rest = $total - ($fetch + $data + $checksum + $output);
if (!is_null($scale) && ($scale < 4)) { if (!is_null($scale) && ($scale < 4)) {
Logger::info('Performance:', ['scale' => $scale, 'resource' => $photo['resource-id'], Logger::debug('Performance:', ['scale' => $scale, 'resource' => $photo['resource-id'],
'total' => number_format($total, 3), 'fetch' => number_format($fetch, 3), 'total' => number_format($total, 3), 'fetch' => number_format($fetch, 3),
'data' => number_format($data, 3), 'checksum' => number_format($checksum, 3), 'data' => number_format($data, 3), 'checksum' => number_format($checksum, 3),
'output' => number_format($output, 3), 'rest' => number_format($rest, 3)]); 'output' => number_format($output, 3), 'rest' => number_format($rest, 3)]);

View File

@ -75,7 +75,7 @@ class Proxy extends BaseModule
} }
if (!local_user()) { if (!local_user()) {
Logger::info('Redirecting not logged in user to original address', ['url' => $request['url']]); Logger::debug('Redirecting not logged in user to original address', ['url' => $request['url']]);
System::externalRedirect($request['url']); System::externalRedirect($request['url']);
} }
@ -87,7 +87,7 @@ class Proxy extends BaseModule
$img_str = $fetchResult->getBody(); $img_str = $fetchResult->getBody();
if (!$fetchResult->isSuccess() || empty($img_str)) { if (!$fetchResult->isSuccess() || empty($img_str)) {
Logger::info('Error fetching image', ['image' => $request['url'], 'return' => $fetchResult->getReturnCode(), 'empty' => empty($img_str)]); Logger::notice('Error fetching image', ['image' => $request['url'], 'return' => $fetchResult->getReturnCode(), 'empty' => empty($img_str)]);
self::responseError(); self::responseError();
// stop. // stop.
} }
@ -98,7 +98,7 @@ class Proxy extends BaseModule
$image = new Image($img_str, $mime); $image = new Image($img_str, $mime);
if (!$image->isValid()) { if (!$image->isValid()) {
Logger::info('The image is invalid', ['image' => $request['url'], 'mime' => $mime]); Logger::notice('The image is invalid', ['image' => $request['url'], 'mime' => $mime]);
self::responseError(); self::responseError();
// stop. // stop.
} }
@ -193,7 +193,7 @@ class Proxy extends BaseModule
private static function responseImageHttpCache(Image $img) private static function responseImageHttpCache(Image $img)
{ {
if (is_null($img) || !$img->isValid()) { if (is_null($img) || !$img->isValid()) {
Logger::info('The cached image is invalid'); Logger::notice('The cached image is invalid');
self::responseError(); self::responseError();
// stop. // stop.
} }

View File

@ -52,7 +52,7 @@ class Delivery
if ($result['serverfailure']) { if ($result['serverfailure']) {
// In a timeout situation we assume that every delivery to that inbox will time out. // 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. // So we set the flag and try all deliveries at a later time.
Logger::info('Inbox delivery has a server failure', ['inbox' => $inbox]); Logger::notice('Inbox delivery has a server failure', ['inbox' => $inbox]);
$serverfail = true; $serverfail = true;
} }
} }
@ -151,7 +151,7 @@ class Delivery
} }
Logger::info('Delivery failed', ['retcode' => $response->getReturnCode(), 'serverfailure' => $serverfail, 'drop' => $drop, 'runtime' => round($runtime, 3), 'uri-id' => $uri_id, 'uid' => $uid, 'item_id' => $item_id, 'cmd' => $cmd, 'inbox' => $inbox]); Logger::notice('Delivery failed', ['retcode' => $response->getReturnCode(), 'serverfailure' => $serverfail, 'drop' => $drop, 'runtime' => round($runtime, 3), 'uri-id' => $uri_id, 'uid' => $uid, 'item_id' => $item_id, 'cmd' => $cmd, 'inbox' => $inbox]);
} }
if ($uri_id) { if ($uri_id) {
if ($success) { if ($success) {

View File

@ -357,7 +357,7 @@ class Processor
$item['diaspora_signed_text'] = $activity['diaspora:comment'] ?? ''; $item['diaspora_signed_text'] = $activity['diaspora:comment'] ?? '';
if (empty($conversation) && empty($activity['directmessage']) && ($item['gravity'] != GRAVITY_PARENT) && !Post::exists(['uri' => $item['thr-parent']])) { if (empty($conversation) && empty($activity['directmessage']) && ($item['gravity'] != GRAVITY_PARENT) && !Post::exists(['uri' => $item['thr-parent']])) {
Logger::info('Parent not found, message will be discarded.', ['thr-parent' => $item['thr-parent']]); Logger::notice('Parent not found, message will be discarded.', ['thr-parent' => $item['thr-parent']]);
if (!$fetch_parents) { if (!$fetch_parents) {
Queue::remove($activity); Queue::remove($activity);
} }
@ -657,6 +657,7 @@ class Processor
$activity['reply-to-id'] = $activity['object_id']; $activity['reply-to-id'] = $activity['object_id'];
$item = self::createItem($activity, false); $item = self::createItem($activity, false);
if (empty($item)) { if (empty($item)) {
Logger::debug('Activity was not prepared', ['id' => $activity['object_id']]);
return; return;
} }
@ -1304,7 +1305,7 @@ class Processor
$pcid = Contact::getIdForURL($url, 0, false); $pcid = Contact::getIdForURL($url, 0, false);
if (empty($pcid)) { if (empty($pcid)) {
Logger::info('Contact not found', ['contact' => $url]); Logger::notice('Contact not found', ['contact' => $url]);
return; return;
} }
@ -1364,7 +1365,7 @@ class Processor
public static function fetchCachedActivity(string $url, int $uid): array public static function fetchCachedActivity(string $url, int $uid): array
{ {
$cachekey = self::CACHEKEY_FETCH_ACTIVITY . $uid . ':' . $url; $cachekey = self::CACHEKEY_FETCH_ACTIVITY . $uid . ':' . hash('sha256', $url);
$object = DI::cache()->get($cachekey); $object = DI::cache()->get($cachekey);
if (!is_null($object)) { if (!is_null($object)) {

View File

@ -391,6 +391,7 @@ class Receiver
// Fetch the activity on Lemmy "Announce" messages (announces of activities) // Fetch the activity on Lemmy "Announce" messages (announces of activities)
if (($type == 'as:Announce') && in_array($object_type, array_merge(self::ACTIVITY_TYPES, ['as:Delete', 'as:Undo', 'as:Update']))) { if (($type == 'as:Announce') && in_array($object_type, array_merge(self::ACTIVITY_TYPES, ['as:Delete', 'as:Undo', 'as:Update']))) {
Logger::debug('Fetch announced activity', ['object' => $object_id]);
$data = Processor::fetchCachedActivity($object_id, $fetch_uid); $data = Processor::fetchCachedActivity($object_id, $fetch_uid);
if (!empty($data)) { if (!empty($data)) {
$type = $object_type; $type = $object_type;
@ -590,6 +591,7 @@ class Receiver
// Lemmy is announcing activities. // Lemmy is announcing activities.
// We are changing the announces into regular activities. // We are changing the announces into regular activities.
if (($type == 'as:Announce') && in_array($object_data['type'] ?? '', array_merge(self::ACTIVITY_TYPES, ['as:Delete', 'as:Undo', 'as:Update']))) { if (($type == 'as:Announce') && in_array($object_data['type'] ?? '', array_merge(self::ACTIVITY_TYPES, ['as:Delete', 'as:Undo', 'as:Update']))) {
Logger::debug('Change type of announce to activity', ['type' => $object_data['type']]);
$type = $object_data['type']; $type = $object_data['type'];
} }
@ -727,11 +729,13 @@ class Receiver
if (!Post::exists(['uri' => $object_data['id'], 'uid' => 0])) { if (!Post::exists(['uri' => $object_data['id'], 'uid' => 0])) {
$item = ActivityPub\Processor::createItem($object_data, $fetch_parents); $item = ActivityPub\Processor::createItem($object_data, $fetch_parents);
if (empty($item)) { if (empty($item)) {
Logger::debug('announced id was not created', ['id' => $object_data['id']]);
return false; return false;
} }
$item['post-reason'] = Item::PR_ANNOUNCEMENT; $item['post-reason'] = Item::PR_ANNOUNCEMENT;
ActivityPub\Processor::postItem($object_data, $item); ActivityPub\Processor::postItem($object_data, $item);
Logger::debug('Created announced id', ['id' => $object_data['id']]);
} else { } else {
Logger::info('Announced id already exists', ['id' => $object_data['id']]); Logger::info('Announced id already exists', ['id' => $object_data['id']]);
Queue::remove($object_data); Queue::remove($object_data);
@ -744,6 +748,7 @@ class Receiver
$announce_object_data['object_id'] = $object_data['object_id']; $announce_object_data['object_id'] = $object_data['object_id'];
$announce_object_data['object_type'] = $object_data['object_type']; $announce_object_data['object_type'] = $object_data['object_type'];
$announce_object_data['push'] = $push; $announce_object_data['push'] = $push;
Logger::debug('Create announce activity', ['id' => $announce_object_data['id'], 'object_data' => $announce_object_data]);
if (!empty($object_data['raw'])) { if (!empty($object_data['raw'])) {
$announce_object_data['raw'] = $object_data['raw']; $announce_object_data['raw'] = $object_data['raw'];

View File

@ -938,7 +938,7 @@ class OStatus
break; break;
default: default:
Logger::warning('Unsupported rel=' . $attribute['rel'] . ', href=' . $attribute['href'] . ', object-type=' . $item['object-type']); Logger::notice('Unsupported rel=' . $attribute['rel'] . ', href=' . $attribute['href'] . ', object-type=' . $item['object-type']);
} }
} }
} }

View File

@ -96,7 +96,7 @@ class OAuth
$token = DBA::selectFirst('application-view', ['uid', 'id', 'name', 'website', 'created_at', 'read', 'write', 'follow', 'push'], $condition); $token = DBA::selectFirst('application-view', ['uid', 'id', 'name', 'website', 'created_at', 'read', 'write', 'follow', 'push'], $condition);
if (!DBA::isResult($token)) { if (!DBA::isResult($token)) {
Logger::warning('Token not found', $condition); Logger::notice('Token not found', $condition);
return []; return [];
} }
Logger::debug('Token found', $token); Logger::debug('Token found', $token);

View File

@ -103,7 +103,7 @@ class Delivery
DBA::close($itemdata); DBA::close($itemdata);
if (empty($target_item)) { if (empty($target_item)) {
Logger::warning('Item ' . $target_id . "wasn't found. Quitting here."); Logger::warning("No target item data. Quitting here.", ['id' => $target_id]);
return; return;
} }