Some more replaced logger
authorMichael <heluecht@pirati.ca>
Sun, 28 Jun 2020 17:35:56 +0000 (17:35 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 28 Jun 2020 17:35:56 +0000 (17:35 +0000)
src/Content/Text/BBCode.php
src/Model/Contact.php

index a6eea10..d1a50da 100644 (file)
@@ -506,14 +506,14 @@ class BBCode
                                                        $Image->scaleDown(640);
                                                        $new_width = $Image->getWidth();
                                                        $new_height = $Image->getHeight();
-                                                       Logger::log('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], Logger::DEBUG);
+                                                       Logger::info('External images scaled', ['orig_width' => $orig_width, 'new_width' => $new_width, 'orig_height' => $orig_height, 'new_height' => $new_height, 'match' => $mtch[0]]);
                                                        $s = str_replace(
                                                                $mtch[0],
                                                                '[img=' . $new_width . 'x' . $new_height. ']' . $mtch[1] . '[/img]'
                                                                . "\n",
                                                                $s
                                                        );
-                                                       Logger::log('scale_external_images: new string: ' . $s, Logger::DEBUG);
+                                                       Logger::info('New string', ['image' => $s]);
                                                }
                                        }
                                }
@@ -541,7 +541,7 @@ class BBCode
                // than the maximum, then don't waste time looking for the images
                if ($maxlen && (strlen($body) > $maxlen)) {
 
-                       Logger::log('the total body length exceeds the limit', Logger::DEBUG);
+                       Logger::info('the total body length exceeds the limit', ['maxlen' => $maxlen, 'body_len' => strlen($body)]);
 
                        $orig_body = $body;
                        $new_body = '';
@@ -561,7 +561,7 @@ class BBCode
 
                                        if (($textlen + $img_start) > $maxlen) {
                                                if ($textlen < $maxlen) {
-                                                       Logger::log('the limit happens before an embedded image', Logger::DEBUG);
+                                                       Logger::info('the limit happens before an embedded image');
                                                        $new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
                                                        $textlen = $maxlen;
                                                }
@@ -575,7 +575,7 @@ class BBCode
 
                                        if (($textlen + $img_end) > $maxlen) {
                                                if ($textlen < $maxlen) {
-                                                       Logger::log('the limit happens before the end of a non-embedded image', Logger::DEBUG);
+                                                       Logger::info('the limit happens before the end of a non-embedded image');
                                                        $new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
                                                        $textlen = $maxlen;
                                                }
@@ -598,11 +598,11 @@ class BBCode
 
                        if (($textlen + strlen($orig_body)) > $maxlen) {
                                if ($textlen < $maxlen) {
-                                       Logger::log('the limit happens after the end of the last image', Logger::DEBUG);
+                                       Logger::info('the limit happens after the end of the last image');
                                        $new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
                                }
                        } else {
-                               Logger::log('the text size with embedded images extracted did not violate the limit', Logger::DEBUG);
+                               Logger::info('the text size with embedded images extracted did not violate the limit');
                                $new_body = $new_body . $orig_body;
                        }
 
index e83a11f..b11919b 100644 (file)
@@ -926,10 +926,10 @@ class Contact
                                return;
                        }
                } elseif (!isset($contact['url'])) {
-                       Logger::log('Empty contact: ' . json_encode($contact) . ' - ' . System::callstack(20), Logger::DEBUG);
+                       Logger::info('Empty contact', ['contact' => $contact, 'callstack' => System::callstack(20)]);
                }
 
-               Logger::log('Contact '.$contact['id'].' is marked for archival', Logger::DEBUG);
+               Logger::info('Contact is marked for archival', ['id' => $contact['id']]);
 
                // Contact already archived or "self" contact? => nothing to do
                if ($contact['archive'] || $contact['self']) {
@@ -988,7 +988,7 @@ class Contact
                        return;
                }
 
-               Logger::log('Contact '.$contact['id'].' is marked as vital again', Logger::DEBUG);
+               Logger::info('Contact is marked as vital again', ['id' => $contact['id']]);
 
                if (!isset($contact['url']) && !empty($contact['id'])) {
                        $fields = ['id', 'url', 'batch'];
@@ -1489,7 +1489,7 @@ class Contact
         */
        public static function getIdForURL($url, $uid = 0, $no_update = false, $default = [], $in_loop = false)
        {
-               Logger::log("Get contact data for url " . $url . " and user " . $uid . " - " . System::callstack(), Logger::DEBUG);
+               Logger::info('Get contact data', ['url' => $url, 'user' => $uid]);
 
                $contact_id = 0;