]> git.mxchange.org Git - friendica.git/commitdiff
Replace Logger with DI::logger() in Content namespace
authorArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 09:32:41 +0000 (09:32 +0000)
committerArt4 <art4@wlabs.de>
Mon, 13 Jan 2025 09:32:41 +0000 (09:32 +0000)
src/Content/Item.php
src/Content/PageInfo.php
src/Content/Text/BBCode.php
src/Content/Text/Markdown.php
src/Content/Widget/VCard.php

index 7343c06aff514b8d1540c076644a21eb0c3045b4..d6e4cb7d59252a924f1463568f29b89e9e274ed0 100644 (file)
@@ -14,7 +14,6 @@ use Friendica\Content\Text\BBCode\Video;
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
-use Friendica\Core\Logger;
 use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
 use Friendica\Core\Protocol;
 use Friendica\Core\Session\Capability\IHandleUserSessions;
@@ -520,18 +519,18 @@ class Item
                                $only_to_group = ($tag[1] == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]);
                                $private_id = $contact['id'];
                                $group_contact = $contact;
-                               Logger::info('Private group or exclusive mention', ['url' => $tag[2], 'mention' => $tag[1]]);
+                               DI::logger()->info('Private group or exclusive mention', ['url' => $tag[2], 'mention' => $tag[1]]);
                        } elseif ($item['allow_cid'] == '<' . $contact['id'] . '>') {
                                $private_group = false;
                                $only_to_group = true;
                                $private_id = $contact['id'];
                                $group_contact = $contact;
-                               Logger::info('Public group', ['url' => $tag[2], 'mention' => $tag[1]]);
+                               DI::logger()->info('Public group', ['url' => $tag[2], 'mention' => $tag[1]]);
                        } else {
-                               Logger::info('Post with group mention will not be converted to a group post', ['url' => $tag[2], 'mention' => $tag[1]]);
+                               DI::logger()->info('Post with group mention will not be converted to a group post', ['url' => $tag[2], 'mention' => $tag[1]]);
                        }
                }
-               Logger::info('Got inform', ['inform' => $item['inform']]);
+               DI::logger()->info('Got inform', ['inform' => $item['inform']]);
 
                if (($item['gravity'] == ItemModel::GRAVITY_PARENT) && !empty($group_contact) && ($private_group || $only_to_group)) {
                        // we tagged a group in a top level post. Now we change the post
@@ -638,7 +637,7 @@ class Item
                $fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network', 'quote-uri-id'];
                $shared_item = Post::selectFirst($fields, ['uri-id' => $item['quote-uri-id'], 'uid' => [$item['uid'], 0], 'private' => [ItemModel::PUBLIC, ItemModel::UNLISTED]]);
                if (!DBA::isResult($shared_item)) {
-                       Logger::notice('Post does not exist.', ['uri-id' => $item['quote-uri-id'], 'uid' => $item['uid']]);
+                       DI::logger()->notice('Post does not exist.', ['uri-id' => $item['quote-uri-id'], 'uid' => $item['uid']]);
                        return $body;
                }
 
@@ -654,7 +653,7 @@ class Item
                $shared_item = Post::selectFirst($fields, ['guid' => $guid, 'uid' => 0, 'private' => [ItemModel::PUBLIC, ItemModel::UNLISTED]]);
 
                if (!DBA::isResult($shared_item)) {
-                       Logger::notice('Post does not exist.', ['guid' => $guid]);
+                       DI::logger()->notice('Post does not exist.', ['guid' => $guid]);
                        return '';
                }
 
@@ -1087,7 +1086,7 @@ class Item
                        $expire_date = time() - ($expire_interval * 86400);
                        $created_date = strtotime($created);
                        if ($created_date < $expire_date) {
-                               Logger::notice('Item created before expiration interval.', ['created' => date('c', $created_date), 'expired' => date('c', $expire_date)]);
+                               DI::logger()->notice('Item created before expiration interval.', ['created' => date('c', $created_date), 'expired' => date('c', $expire_date)]);
                                return true;
                        }
                }
index 05579847760633e980848529310c96e14f0ad9e5..99863b891000069a1650210b89dce81bc4767342 100644 (file)
@@ -8,7 +8,6 @@
 namespace Friendica\Content;
 
 use Friendica\Core\Hook;
-use Friendica\Core\Logger;
 use Friendica\DI;
 use Friendica\Network\HTTPException;
 use Friendica\Util\ParseUrl;
@@ -28,7 +27,7 @@ class PageInfo
         */
        public static function searchAndAppendToBody(string $body, bool $searchNakedUrls = false, bool $no_photos = false)
        {
-               Logger::debug('add_page_info_to_body: fetch page info for body', ['body' => $body]);
+               DI::logger()->debug('add_page_info_to_body: fetch page info for body', ['body' => $body]);
 
                $url = self::getRelevantUrlFromBody($body, $searchNakedUrls);
                if (!$url) {
@@ -194,7 +193,7 @@ class PageInfo
                        }
                }
 
-               Logger::debug('fetch page info for URL', ['url' => $url, 'data' => $data]);
+               DI::logger()->debug('fetch page info for URL', ['url' => $url, 'data' => $data]);
 
                return $data;
        }
index 900032c33ef7970d2e019abc51db29cc9e5184f7..458041f4bc8cc0135cb2e66a4799567f8312b760 100644 (file)
@@ -16,7 +16,6 @@ use Friendica\Content\OEmbed;
 use Friendica\Content\PageInfo;
 use Friendica\Content\Smilies;
 use Friendica\Core\Hook;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\DI;
@@ -328,7 +327,7 @@ class BBCode
                // than the maximum, then don't waste time looking for the images
                if ($maxlen && (strlen($body) > $maxlen)) {
 
-                       Logger::info('the total body length exceeds the limit', ['maxlen' => $maxlen, 'body_len' => strlen($body)]);
+                       DI::logger()->info('the total body length exceeds the limit', ['maxlen' => $maxlen, 'body_len' => strlen($body)]);
 
                        $orig_body = $body;
                        $new_body = '';
@@ -348,7 +347,7 @@ class BBCode
 
                                        if (($textlen + $img_start) > $maxlen) {
                                                if ($textlen < $maxlen) {
-                                                       Logger::debug('the limit happens before an embedded image');
+                                                       DI::logger()->debug('the limit happens before an embedded image');
                                                        $new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
                                                        $textlen = $maxlen;
                                                }
@@ -362,7 +361,7 @@ class BBCode
 
                                        if (($textlen + $img_end) > $maxlen) {
                                                if ($textlen < $maxlen) {
-                                                       Logger::debug('the limit happens before the end of a non-embedded image');
+                                                       DI::logger()->debug('the limit happens before the end of a non-embedded image');
                                                        $new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
                                                        $textlen = $maxlen;
                                                }
@@ -385,11 +384,11 @@ class BBCode
 
                        if (($textlen + strlen($orig_body)) > $maxlen) {
                                if ($textlen < $maxlen) {
-                                       Logger::debug('the limit happens after the end of the last image');
+                                       DI::logger()->debug('the limit happens after the end of the last image');
                                        $new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
                                }
                        } else {
-                               Logger::debug('the text size with embedded images extracted did not violate the limit');
+                               DI::logger()->debug('the text size with embedded images extracted did not violate the limit');
                                $new_body = $new_body . $orig_body;
                        }
 
@@ -2107,7 +2106,7 @@ class BBCode
                try {
                        return (string)Uri::fromParts($parts);
                } catch (\Throwable $th) {
-                       Logger::notice('Exception on unparsing url', ['url' => $url, 'parts' => $parts, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
+                       DI::logger()->notice('Exception on unparsing url', ['url' => $url, 'parts' => $parts, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
                        return $url;
                }
        }
index 211369f71258ba32ee3113f5dc76e02dcd872d8d..f0ac888ab235d5e08a913b9c09f8ad566b53802e 100644 (file)
@@ -7,7 +7,6 @@
 
 namespace Friendica\Content\Text;
 
-use Friendica\Core\Logger;
 use Friendica\DI;
 use Friendica\Model\Contact;
 
@@ -97,7 +96,7 @@ class Markdown
        {
                // @TODO Temporary until we find the source of the null value to finally set the correct type-hint
                if (is_null($s)) {
-                       Logger::warning('Received null value');
+                       DI::logger()->warning('Received null value');
                        return '';
                }
 
index 7feac4403c6747437853813cb0a3b90c15bff6ad..b3943720d2dcfe5bc6ffaea96ea12faf2ef5d01c 100644 (file)
@@ -9,7 +9,6 @@ namespace Friendica\Content\Widget;
 
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Text\BBCode;
-use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\DI;
@@ -34,7 +33,7 @@ class VCard
        public static function getHTML(array $contact, bool $hide_mention = false, bool $hide_follow = false): string
        {
                if (!isset($contact['network']) || !isset($contact['id'])) {
-                       Logger::warning('Incomplete contact', ['contact' => $contact]);
+                       DI::logger()->warning('Incomplete contact', ['contact' => $contact]);
                }
 
                $contact_url = Contact::getProfileLink($contact);