diff --git a/src/Module/Api/Mastodon/Accounts/Statuses.php b/src/Module/Api/Mastodon/Accounts/Statuses.php index c67476b4ba..679e6e8c3d 100644 --- a/src/Module/Api/Mastodon/Accounts/Statuses.php +++ b/src/Module/Api/Mastodon/Accounts/Statuses.php @@ -7,9 +7,7 @@ namespace Friendica\Module\Api\Mastodon\Accounts; -use Friendica\Core\Logger; use Friendica\Core\Protocol; -use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Conversation; @@ -104,7 +102,7 @@ class Statuses extends BaseApi $this->updateBoundaries($status, $item, $request['friendica_order']); $statuses[] = $status; } catch (\Throwable $th) { - Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); + $this->logger->info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); } } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php b/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php index 0f920ef2a4..30a33f1e3b 100644 --- a/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php +++ b/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php @@ -7,7 +7,6 @@ namespace Friendica\Module\Api\Mastodon\Accounts; -use Friendica\Core\Logger; use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Photo; @@ -71,9 +70,9 @@ class UpdateCredentials extends BaseApi $profile['about'] = $request['note']; } - Logger::debug('Patch data', ['data' => $request, 'files' => $_FILES]); + $this->logger->debug('Patch data', ['data' => $request, 'files' => $_FILES]); - Logger::info('Update profile and user', ['uid' => $uid, 'user' => $user, 'profile' => $profile]); + $this->logger->info('Update profile and user', ['uid' => $uid, 'user' => $user, 'profile' => $profile]); if (!empty($request['avatar'])) { Photo::uploadAvatar($uid, $request['avatar']); diff --git a/src/Module/Api/Mastodon/Bookmarks.php b/src/Module/Api/Mastodon/Bookmarks.php index 99ac8b9efc..b0f0ca34a5 100644 --- a/src/Module/Api/Mastodon/Bookmarks.php +++ b/src/Module/Api/Mastodon/Bookmarks.php @@ -7,8 +7,6 @@ namespace Friendica\Module\Api\Mastodon; -use Friendica\Core\Logger; -use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Post; @@ -64,7 +62,7 @@ class Bookmarks extends BaseApi try { $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes); } catch (\Exception $exception) { - Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]); + $this->logger->info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]); } } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Directory.php b/src/Module/Api/Mastodon/Directory.php index da86fa388f..bc6f84c084 100644 --- a/src/Module/Api/Mastodon/Directory.php +++ b/src/Module/Api/Mastodon/Directory.php @@ -7,9 +7,7 @@ namespace Friendica\Module\Api\Mastodon; -use Friendica\Core\Logger; use Friendica\Core\Protocol; -use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Module\BaseApi; @@ -34,7 +32,7 @@ class Directory extends BaseApi 'local' => false, // Only return local accounts. ], $request); - Logger::info('directory', ['offset' => $request['offset'], 'limit' => $request['limit'], 'order' => $request['order'], 'local' => $request['local']]); + $this->logger->info('directory', ['offset' => $request['offset'], 'limit' => $request['limit'], 'order' => $request['order'], 'local' => $request['local']]); if ($request['local']) { $table = 'owner-view'; diff --git a/src/Module/Api/Mastodon/Favourited.php b/src/Module/Api/Mastodon/Favourited.php index 53dfef0722..3d9ec883bc 100644 --- a/src/Module/Api/Mastodon/Favourited.php +++ b/src/Module/Api/Mastodon/Favourited.php @@ -7,8 +7,6 @@ namespace Friendica\Module\Api\Mastodon; -use Friendica\Core\Logger; -use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Item; @@ -66,7 +64,7 @@ class Favourited extends BaseApi try { $statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid, $display_quotes); } catch (\Exception $exception) { - Logger::info('Post not fetchable', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'exception' => $exception]); + $this->logger->info('Post not fetchable', ['uri-id' => $item['thr-parent-id'], 'uid' => $uid, 'exception' => $exception]); } } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Media.php b/src/Module/Api/Mastodon/Media.php index b15f1cc81c..5dbcfc3687 100644 --- a/src/Module/Api/Mastodon/Media.php +++ b/src/Module/Api/Mastodon/Media.php @@ -7,7 +7,6 @@ namespace Friendica\Module\Api\Mastodon; -use Friendica\Core\Logger; use Friendica\DI; use Friendica\Model\Attach; use Friendica\Model\Contact; @@ -33,10 +32,10 @@ class Media extends BaseApi 'focus' => '', // Two floating points (x,y), comma-delimited ranging from -1.0 to 1.0 ], $request); - Logger::info('Photo post', ['request' => $request, 'files' => $_FILES]); + $this->logger->info('Photo post', ['request' => $request, 'files' => $_FILES]); if (empty($request['file'])) { - Logger::notice('Upload is invalid', ['request' => $request]); + $this->logger->notice('Upload is invalid', ['request' => $request]); $this->logAndJsonError(422, $this->errorFactory->UnprocessableEntity()); } @@ -45,7 +44,7 @@ class Media extends BaseApi if (in_array($type, [Post\Media::IMAGE, Post\Media::UNKNOWN, Post\Media::APPLICATION])) { $media = Photo::upload($uid, $request['file'], '', null, null, '', '', $request['description']); if (!empty($media)) { - Logger::info('Uploaded photo', ['media' => $media]); + $this->logger->info('Uploaded photo', ['media' => $media]); $this->jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id'])); } elseif ($type == Post\Media::IMAGE) { $this->jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id'])); @@ -58,20 +57,20 @@ class Media extends BaseApi $maxFileSize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maxfilesize')); if ($fileSize <= 0) { - Logger::notice('Filesize is invalid', ['size' => $fileSize, 'request' => $request]); + $this->logger->notice('Filesize is invalid', ['size' => $fileSize, 'request' => $request]); @unlink($tempFileName); $this->logAndJsonError(422, $this->errorFactory->UnprocessableEntity()); } if ($maxFileSize && $fileSize > $maxFileSize) { - Logger::notice('Filesize is too large', ['size' => $fileSize, 'max' => $maxFileSize, 'request' => $request]); + $this->logger->notice('Filesize is too large', ['size' => $fileSize, 'max' => $maxFileSize, 'request' => $request]); @unlink($tempFileName); $this->logAndJsonError(422, $this->errorFactory->UnprocessableEntity()); } $id = Attach::storeFile($tempFileName, self::getCurrentUserID(), $fileName, $request['file']['type'], '<' . Contact::getPublicIdByUserId(self::getCurrentUserID()) . '>'); @unlink($tempFileName); - Logger::info('Uploaded media', ['id' => $id]); + $this->logger->info('Uploaded media', ['id' => $id]); $this->jsonExit(DI::mstdnAttachment()->createFromAttach($id)); } diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php index 45556bc3aa..831ac010f8 100644 --- a/src/Module/Api/Mastodon/Search.php +++ b/src/Module/Api/Mastodon/Search.php @@ -7,7 +7,6 @@ namespace Friendica\Module\Api\Mastodon; -use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Database\DBA; use Friendica\DI; @@ -173,7 +172,7 @@ class Search extends BaseApi try { $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes); } catch (\Exception $exception) { - Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]); + $this->logger->info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]); } } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Timelines/Home.php b/src/Module/Api/Mastodon/Timelines/Home.php index 5272ce0b9a..c798a05ae7 100644 --- a/src/Module/Api/Mastodon/Timelines/Home.php +++ b/src/Module/Api/Mastodon/Timelines/Home.php @@ -7,7 +7,6 @@ namespace Friendica\Module\Api\Mastodon\Timelines; -use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Item; @@ -79,7 +78,7 @@ class Home extends BaseApi $this->updateBoundaries($status, $item, $request['friendica_order']); $statuses[] = $status; } catch (\Throwable $th) { - Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); + $this->logger->info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); } } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Timelines/ListTimeline.php b/src/Module/Api/Mastodon/Timelines/ListTimeline.php index 249955fdb3..88ae013012 100644 --- a/src/Module/Api/Mastodon/Timelines/ListTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/ListTimeline.php @@ -11,7 +11,6 @@ use Friendica\App\Arguments; use Friendica\App\BaseURL; use Friendica\AppHelper; use Friendica\Core\L10n; -use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; @@ -84,7 +83,7 @@ class ListTimeline extends BaseApi $this->updateBoundaries($status, $item, $request['friendica_order']); $statuses[] = $status; } catch (\Throwable $th) { - Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); + $this->logger->info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); } } diff --git a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php index 411a159037..3327757c11 100644 --- a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php @@ -12,7 +12,6 @@ use Friendica\App\BaseURL; use Friendica\AppHelper; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; -use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Database\DBA; use Friendica\DI; @@ -113,7 +112,7 @@ class PublicTimeline extends BaseApi $this->updateBoundaries($status, $item, $request['friendica_order']); $statuses[] = $status; } catch (\Throwable $th) { - Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); + $this->logger->info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); } } diff --git a/src/Module/Api/Mastodon/Timelines/Tag.php b/src/Module/Api/Mastodon/Timelines/Tag.php index bfe54db0df..155c4c7582 100644 --- a/src/Module/Api/Mastodon/Timelines/Tag.php +++ b/src/Module/Api/Mastodon/Timelines/Tag.php @@ -7,9 +7,7 @@ namespace Friendica\Module\Api\Mastodon\Timelines; -use Friendica\Core\Logger; use Friendica\Core\Protocol; -use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Item; @@ -107,7 +105,7 @@ class Tag extends BaseApi try { $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes); } catch (\Exception $exception) { - Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]); + $this->logger->info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'exception' => $exception]); } } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Trends/Statuses.php b/src/Module/Api/Mastodon/Trends/Statuses.php index 142766593d..ea28647395 100644 --- a/src/Module/Api/Mastodon/Trends/Statuses.php +++ b/src/Module/Api/Mastodon/Trends/Statuses.php @@ -12,7 +12,6 @@ use Friendica\App\BaseURL; use Friendica\AppHelper; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; -use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Database\DBA; use Friendica\DI; @@ -67,7 +66,7 @@ class Statuses extends BaseApi try { $trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, $display_quotes); } catch (\Exception $exception) { - Logger::info('Post not fetchable', ['uri-id' => $status['uri-id'], 'uid' => $uid, 'exception' => $exception]); + $this->logger->info('Post not fetchable', ['uri-id' => $status['uri-id'], 'uid' => $uid, 'exception' => $exception]); } } DBA::close($statuses);