]> git.mxchange.org Git - friendica.git/commitdiff
Replace deprecated `log` calls
authorMichael <heluecht@pirati.ca>
Wed, 20 Oct 2021 18:53:52 +0000 (18:53 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 20 Oct 2021 18:53:52 +0000 (18:53 +0000)
28 files changed:
mod/display.php
mod/pubsub.php
mod/pubsubhubbub.php
mod/redir.php
mod/wall_upload.php
src/BaseModule.php
src/Model/Contact.php
src/Model/Event.php
src/Model/Item.php
src/Model/Mail.php
src/Model/User.php
src/Module/Attach.php
src/Module/Register.php
src/Protocol/DFRN.php
src/Protocol/OStatus.php
src/Protocol/Salmon.php
src/Util/Crypto.php
src/Util/DateTimeFormat.php
src/Util/HTTPSignature.php
src/Util/Network.php
src/Util/Strings.php
src/Util/XML.php
src/Worker/CheckVersion.php
src/Worker/Directory.php
src/Worker/ProfileUpdate.php
src/Worker/PubSubPublish.php
view/theme/frio/theme.php
view/theme/vier/style.php

index ef835848eadda17c72361e552581e80ceebc8383..b53dd354381b2266cea49cace30e3e9437db1342 100644 (file)
@@ -99,7 +99,7 @@ function display_init(App $a)
        }
 
        if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
-               Logger::log('Directly serving XML for uri-id '.$item['uri-id'], Logger::DEBUG);
+               Logger::info('Directly serving XML for uri-id '.$item['uri-id']);
                displayShowFeed($item['uri-id'], $item['uid'], false);
        }
 
index 1dfbd0b3dc9960f72848dc156400f6e2e489b5d9..99e8015f19dec8126145279d30bd0e7cc41e2775 100644 (file)
@@ -59,14 +59,14 @@ function pubsub_init(App $a)
                $hub_challenge = Strings::escapeTags(trim($_GET['hub_challenge'] ?? ''));
                $hub_verify    = Strings::escapeTags(trim($_GET['hub_verify_token'] ?? ''));
 
-               Logger::log('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick);
-               Logger::log('Data: ' . print_r($_GET,true), Logger::DATA);
+               Logger::notice('Subscription from ' . $_SERVER['REMOTE_ADDR'] . ' Mode: ' . $hub_mode . ' Nick: ' . $nick);
+               Logger::debug('Data: ', ['get' => $_GET]);
 
                $subscribe = (($hub_mode === 'subscribe') ? 1 : 0);
 
                $owner = DBA::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
                if (!DBA::isResult($owner)) {
-                       Logger::log('Local account not found: ' . $nick);
+                       Logger::notice('Local account not found: ' . $nick);
                        hub_return(false, '');
                }
 
@@ -78,12 +78,12 @@ function pubsub_init(App $a)
 
                $contact = DBA::selectFirst('contact', ['id', 'poll'], $condition);
                if (!DBA::isResult($contact)) {
-                       Logger::log('Contact ' . $contact_id . ' not found.');
+                       Logger::notice('Contact ' . $contact_id . ' not found.');
                        hub_return(false, '');
                }
 
                if (!empty($hub_topic) && !Strings::compareLink($hub_topic, $contact['poll'])) {
-                       Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
+                       Logger::notice('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
                        hub_return(false, '');
                }
 
@@ -91,13 +91,13 @@ function pubsub_init(App $a)
                // Don't allow outsiders to unsubscribe us.
 
                if (($hub_mode === 'unsubscribe') && empty($hub_verify)) {
-                       Logger::log('Bogus unsubscribe');
+                       Logger::notice('Bogus unsubscribe');
                        hub_return(false, '');
                }
 
                if (!empty($hub_mode)) {
                        Contact::update(['subhub' => $subscribe], ['id' => $contact['id']]);
-                       Logger::log($hub_mode . ' success for contact ' . $contact_id . '.');
+                       Logger::notice($hub_mode . ' success for contact ' . $contact_id . '.');
                }
                hub_return(true, $hub_challenge);
        }
@@ -107,8 +107,8 @@ function pubsub_post(App $a)
 {
        $xml = Network::postdata();
 
-       Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' .  DI::args()->getCommand() . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
-       Logger::log('Data: ' . $xml, Logger::DATA);
+       Logger::notice('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' .  DI::args()->getCommand() . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
+       Logger::debug('Data: ' . $xml);
 
        $nick       = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(trim(DI::args()->getArgv()[1])) : '');
        $contact_id = ((DI::args()->getArgc() > 2) ? intval(DI::args()->getArgv()[2])       : 0 );
@@ -126,10 +126,10 @@ function pubsub_post(App $a)
                if (!empty($author['contact-id'])) {
                        $condition = ['id' => $author['contact-id'], 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
                        $contact = DBA::selectFirst('contact', [], $condition);
-                       Logger::log('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
+                       Logger::notice('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.');
                }
                if (!DBA::isResult($contact)) {
-                       Logger::log('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml);
+                       Logger::notice('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml);
                        hub_post_return();
                }
        }
@@ -139,7 +139,7 @@ function pubsub_post(App $a)
        }
 
        if (!in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND]) && ($contact['network'] != Protocol::FEED)) {
-               Logger::log('Contact ' . $contact['id'] . ' is not expected to share with us - ignored.');
+               Logger::notice('Contact ' . $contact['id'] . ' is not expected to share with us - ignored.');
                hub_post_return();
        }
 
@@ -149,7 +149,7 @@ function pubsub_post(App $a)
                hub_post_return();
        }
 
-       Logger::log('Import item for ' . $nick . ' from ' . $contact['nick'] . ' (' . $contact['id'] . ')');
+       Logger::notice('Import item for ' . $nick . ' from ' . $contact['nick'] . ' (' . $contact['id'] . ')');
        $feedhub = '';
        OStatus::import($xml, $importer, $contact, $feedhub);
 
index bc90c76d66533ca5ec1df66557637c2bf7b6e583..f985bef63bc1548440465a84e4568794e309b72f 100644 (file)
@@ -60,11 +60,11 @@ function pubsubhubbub_init(App $a) {
                } elseif ($hub_mode === 'unsubscribe') {
                        $subscribe = 0;
                } else {
-                       Logger::log("Invalid hub_mode=$hub_mode, ignoring.");
+                       Logger::notice("Invalid hub_mode=$hub_mode, ignoring.");
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
-               Logger::log("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
+               Logger::notice("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
 
                if (DI::args()->getArgc() > 1) {
                        // Normally the url should now contain the nick name as last part of the url
@@ -77,7 +77,7 @@ function pubsubhubbub_init(App $a) {
                $nick = basename($nick, '.atom');
 
                if (!$nick) {
-                       Logger::log('Bad hub_topic=$hub_topic, ignoring.');
+                       Logger::notice('Bad hub_topic=$hub_topic, ignoring.');
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
@@ -85,7 +85,7 @@ function pubsubhubbub_init(App $a) {
                $condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
                $owner = DBA::selectFirst('user', ['uid', 'nickname'], $condition);
                if (!DBA::isResult($owner)) {
-                       Logger::log('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
+                       Logger::notice('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
@@ -94,7 +94,7 @@ function pubsubhubbub_init(App $a) {
                        'pending' => false, 'self' => true];
                $contact = DBA::selectFirst('contact', ['poll'], $condition);
                if (!DBA::isResult($contact)) {
-                       Logger::log('Self contact for user ' . $owner['uid'] . ' not found.');
+                       Logger::notice('Self contact for user ' . $owner['uid'] . ' not found.');
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
@@ -103,7 +103,7 @@ function pubsubhubbub_init(App $a) {
                $self = DI::baseUrl() . '/api/statuses/user_timeline/' . $owner['nickname'] . '.atom';
 
                if (!Strings::compareLink($hub_topic, $contact['poll']) && !Strings::compareLink($hub_topic2, $contact['poll']) && !Strings::compareLink($hub_topic, $self)) {
-                       Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
+                       Logger::notice('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
@@ -131,14 +131,14 @@ function pubsubhubbub_init(App $a) {
 
                // give up if the HTTP return code wasn't a success (2xx)
                if ($ret < 200 || $ret > 299) {
-                       Logger::log("Subscriber verification for $hub_topic at $hub_callback returned $ret, ignoring.");
+                       Logger::notice("Subscriber verification for $hub_topic at $hub_callback returned $ret, ignoring.");
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
                // check that the correct hub_challenge code was echoed back
                if (trim($body) !== $hub_challenge) {
-                       Logger::log("Subscriber did not echo back hub.challenge, ignoring.");
-                       Logger::log("\"$hub_challenge\" != \"".trim($body)."\"");
+                       Logger::notice("Subscriber did not echo back hub.challenge, ignoring.");
+                       Logger::notice("\"$hub_challenge\" != \"".trim($body)."\"");
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
index a158f31798cdf01313268c616e608b506ead8e05..e96a58b63a965f50ef70016481be5b38c46f3571 100644 (file)
@@ -76,7 +76,7 @@ function redir_init(App $a) {
                        // Local user is already authenticated.
                        redir_check_url($contact_url, $url);
                        $target_url = $url ?: $contact_url;
-                       Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, Logger::DEBUG);
+                       Logger::info($contact['name'] . " is already authenticated. Redirecting to " . $target_url);
                        $a->redirect($target_url);
                }
        }
@@ -93,7 +93,7 @@ function redir_init(App $a) {
                        // Remote user is already authenticated.
                        redir_check_url($contact_url, $url);
                        $target_url = $url ?: $contact_url;
-                       Logger::log($contact['name'] . " is already authenticated. Redirecting to " . $target_url, Logger::DEBUG);
+                       Logger::info($contact['name'] . " is already authenticated. Redirecting to " . $target_url);
                        $a->redirect($target_url);
                }
        }
@@ -112,7 +112,7 @@ function redir_init(App $a) {
                $url .= $separator . 'zrl=' . urlencode($my_profile);
        }
 
-       Logger::log('redirecting to ' . $url, Logger::DEBUG);
+       Logger::info('redirecting to ' . $url);
        $a->redirect($url);
 }
 
index f915954f0a1f6c42150911089b2803d0225d2011..38819c9a581768893e913ab2c2d8ad30265e8293 100644 (file)
@@ -38,7 +38,7 @@ use Friendica\Util\Strings;
 
 function wall_upload_post(App $a, $desktopmode = true)
 {
-       Logger::log("wall upload: starting new upload", Logger::DEBUG);
+       Logger::info("wall upload: starting new upload");
 
        $r_json = (!empty($_GET['response']) && $_GET['response'] == 'json');
        $album = trim($_GET['album'] ?? '');
@@ -156,8 +156,8 @@ function wall_upload_post(App $a, $desktopmode = true)
 
        $filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
 
-       Logger::log("File upload src: " . $src . " - filename: " . $filename .
-               " - size: " . $filesize . " - type: " . $filetype, Logger::DEBUG);
+       Logger::info("File upload src: " . $src . " - filename: " . $filename .
+               " - size: " . $filesize . " - type: " . $filetype);
 
        $imagedata = @file_get_contents($src);
        $Image = new Image($imagedata, $filetype);
@@ -183,7 +183,7 @@ function wall_upload_post(App $a, $desktopmode = true)
        if ($max_length > 0) {
                $Image->scaleDown($max_length);
                $filesize = strlen($Image->asString());
-               Logger::log("File upload: Scaling picture to new size " . $max_length, Logger::DEBUG);
+               Logger::info("File upload: Scaling picture to new size " . $max_length);
        }
 
        $width = $Image->getWidth();
@@ -278,11 +278,11 @@ function wall_upload_post(App $a, $desktopmode = true)
                        echo json_encode(['picture' => $picture]);
                        exit();
                }
-               Logger::log("upload done", Logger::DEBUG);
+               Logger::info("upload done");
                return $picture;
        }
 
-       Logger::log("upload done", Logger::DEBUG);
+       Logger::info("upload done");
 
        if ($r_json) {
                echo json_encode(['ok' => true]);
index d7ca5798deb61ae48bbc0eabd96a40689d7c6362..ced1e55c397c51d81f2f6b866cac58ea83f422f3 100644 (file)
@@ -183,8 +183,8 @@ abstract class BaseModule
        public static function checkFormSecurityTokenRedirectOnError($err_redirect, $typename = '', $formname = 'form_security_token')
        {
                if (!self::checkFormSecurityToken($typename, $formname)) {
-                       Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
-                       Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
+                       Logger::notice('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
+                       Logger::debug('checkFormSecurityToken failed', ['request' => $_REQUEST]);
                        notice(self::getFormSecurityStandardErrorMessage());
                        DI::baseUrl()->redirect($err_redirect);
                }
@@ -193,8 +193,8 @@ abstract class BaseModule
        public static function checkFormSecurityTokenForbiddenOnError($typename = '', $formname = 'form_security_token')
        {
                if (!self::checkFormSecurityToken($typename, $formname)) {
-                       Logger::log('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
-                       Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
+                       Logger::notice('checkFormSecurityToken failed: user ' . DI::app()->getLoggedInUserNickname() . ' - form element ' . $typename);
+                       Logger::debug('checkFormSecurityToken failed', ['request' => $_REQUEST]);
 
                        throw new \Friendica\Network\HTTPException\ForbiddenException();
                }
index 06e546d6145f3cfdeda927f3609789fc85f9cc15..f2e2bf92f3525146b7911dfaf1f3fa899c3d73d0 100644 (file)
@@ -2395,7 +2395,7 @@ class Contact
                }
 
                if (($network != '') && ($ret['network'] != $network)) {
-                       Logger::log('Expected network ' . $network . ' does not match actual network ' . $ret['network']);
+                       Logger::notice('Expected network ' . $network . ' does not match actual network ' . $ret['network']);
                        return $result;
                }
 
@@ -2545,7 +2545,7 @@ class Contact
                                }
                        } elseif ($protocol == Protocol::DIASPORA) {
                                $ret = Diaspora::sendShare($owner, $contact);
-                               Logger::log('share returns: ' . $ret);
+                               Logger::notice('share returns: ' . $ret);
                        } elseif ($protocol == Protocol::ACTIVITYPUB) {
                                $activity_id = ActivityPub\Transmitter::activityIDFromContact($contact_id);
                                if (empty($activity_id)) {
@@ -2554,7 +2554,7 @@ class Contact
                                }
 
                                $ret = ActivityPub\Transmitter::sendActivity('Follow', $contact['url'], $uid, $activity_id);
-                               Logger::log('Follow returns: ' . $ret);
+                               Logger::notice('Follow returns: ' . $ret);
                        }
                }
 
@@ -2672,7 +2672,7 @@ class Contact
                } else {
                        // send email notification to owner?
                        if (DBA::exists('contact', ['nurl' => Strings::normaliseLink($url), 'uid' => $importer['uid'], 'pending' => true])) {
-                               Logger::log('ignoring duplicated connection request from pending contact ' . $url);
+                               Logger::notice('ignoring duplicated connection request from pending contact ' . $url);
                                return null;
                        }
 
@@ -2791,7 +2791,7 @@ class Contact
                $contacts = DBA::select('contact', ['id', 'uid', 'name', 'url', 'bd'], $condition);
 
                while ($contact = DBA::fetch($contacts)) {
-                       Logger::log('update_contact_birthday: ' . $contact['bd']);
+                       Logger::notice('update_contact_birthday: ' . $contact['bd']);
 
                        $nextbd = DateTimeFormat::utcNow('Y') . substr($contact['bd'], 4);
 
index ef2b55b68cdc2ae29d4868f21a2d7bbb544cee02..857b6c5b88c6834eb650c2f77a735ed81281d0f9 100644 (file)
@@ -230,7 +230,7 @@ class Event
                }
 
                DBA::delete('event', ['id' => $event_id]);
-               Logger::log("Deleted event ".$event_id, Logger::DEBUG);
+               Logger::info("Deleted event", ['id' => $event_id]);
        }
 
        /**
index 285187e5fbe70c6db44de2c32b8394917f8b2209..297506176aa500010d892c5fa6f0d35c2ecf8994 100644 (file)
@@ -971,7 +971,7 @@ class Item
                }
 
                if (!empty($item['cancel'])) {
-                       Logger::log('post cancelled by addon.');
+                       Logger::notice('post cancelled by addon.');
                        return 0;
                }
 
@@ -1885,7 +1885,7 @@ class Item
                        foreach ($matches as $mtch) {
                                if (Strings::compareLink($link, $mtch[1]) || Strings::compareLink($dlink, $mtch[1])) {
                                        $mention = true;
-                                       Logger::log('mention found: ' . $mtch[2]);
+                                       Logger::notice('mention found', ['mention' => $mtch[2]]);
                                }
                        }
                }
@@ -2305,7 +2305,7 @@ class Item
                        ++$expired;
                }
                DBA::close($items);
-               Logger::log('User ' . $uid . ": expired $expired items; expire items: $expire_items, expire notes: $expire_notes, expire starred: $expire_starred, expire photos: $expire_photos");
+               Logger::notice('User ' . $uid . ": expired $expired items; expire items: $expire_items, expire notes: $expire_notes, expire starred: $expire_starred, expire photos: $expire_photos");
        }
 
        public static function firstPostDate($uid, $wall = false)
@@ -2354,7 +2354,7 @@ class Item
 
                $item = Post::selectFirst(self::ITEM_FIELDLIST, ['id' => $item_id]);
                if (!DBA::isResult($item)) {
-                       Logger::log('like: unknown item ' . $item_id);
+                       Logger::notice('like: unknown item', ['id' => $item_id]);
                        return false;
                }
 
index f9c197ffa0fa55dd7939fea61c098daa5f4162e6..7cd836610b6ce924650f90f868a902707dc2b63a 100644 (file)
@@ -187,7 +187,7 @@ class Mail
                }
 
                if (!$convid) {
-                       Logger::log('send message: conversation not found.');
+                       Logger::notice('send message: conversation not found.');
                        return -4;
                }
 
@@ -291,7 +291,7 @@ class Mail
                }
 
                if (!$convid) {
-                       Logger::log('send message: conversation not found.');
+                       Logger::notice('send message: conversation not found.');
                        return -4;
                }
 
index 263bba99c8355785e4d297df08fc45d089da4612..79449434287ad7be81965fa8dd3619d29dbbf640 100644 (file)
@@ -1517,7 +1517,7 @@ class User
                        return false;
                }
 
-               Logger::log('Removing user: ' . $uid);
+               Logger::notice('Removing user', ['user' => $uid]);
 
                $user = DBA::selectFirst('user', [], ['uid' => $uid]);
 
index d9a6d9f64c1efd4d90e452902958724c0bbf7031..a4bb9b42215cbbcd044d2e843ff0c21576ac5c63 100644 (file)
@@ -57,7 +57,7 @@ class Attach extends BaseModule
 
                $data = MAttach::getData($item);
                if (is_null($data)) {
-                       Logger::log('NULL data for attachment with id ' . $item['id']);
+                       Logger::notice('NULL data for attachment with id ' . $item['id']);
                        throw new \Friendica\Network\HTTPException\NotFoundException(DI::l10n()->t('Item was not found.'));
                }
 
index d93c8754feb4a7f89c67017abc37aa6108d6e2b3..e4a417fbaf11f87b28f13f4584e6c90cda522bbe 100644 (file)
@@ -82,7 +82,7 @@ class Register extends BaseModule
                if ($max_dailies) {
                        $count = DBA::count('user', ['`register_date` > UTC_TIMESTAMP - INTERVAL 1 day']);
                        if ($count >= $max_dailies) {
-                               Logger::log('max daily registrations exceeded.');
+                               Logger::notice('max daily registrations exceeded.');
                                notice(DI::l10n()->t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.'));
                                return '';
                        }
index 8c511c2cd5fbe1b1225e3ab04e5501501b8f9a4c..6e35ae23a99622532660b4509e21dc1f3dbc7419 100644 (file)
@@ -929,21 +929,21 @@ class DFRN
        {
                if (!$public_batch) {
                        if (empty($contact['addr'])) {
-                               Logger::log('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
+                               Logger::notice('Empty contact handle for ' . $contact['id'] . ' - ' . $contact['url'] . ' - trying to update it.');
                                if (Contact::updateFromProbe($contact['id'])) {
                                        $new_contact = DBA::selectFirst('contact', ['addr'], ['id' => $contact['id']]);
                                        $contact['addr'] = $new_contact['addr'];
                                }
 
                                if (empty($contact['addr'])) {
-                                       Logger::log('Unable to find contact handle for ' . $contact['id'] . ' - ' . $contact['url']);
+                                       Logger::notice('Unable to find contact handle for ' . $contact['id'] . ' - ' . $contact['url']);
                                        return -21;
                                }
                        }
 
                        $fcontact = FContact::getByURL($contact['addr']);
                        if (empty($fcontact)) {
-                               Logger::log('Unable to find contact details for ' . $contact['id'] . ' - ' . $contact['addr']);
+                               Logger::notice('Unable to find contact details for ' . $contact['id'] . ' - ' . $contact['addr']);
                                return -22;
                        }
                        $pubkey = $fcontact['pubkey'];
@@ -976,7 +976,7 @@ class DFRN
 
                $curl_stat = $postResult->getReturnCode();
                if (empty($curl_stat) || empty($xml)) {
-                       Logger::log('Empty answer from ' . $contact['id'] . ' - ' . $dest_url);
+                       Logger::notice('Empty answer from ' . $contact['id'] . ' - ' . $dest_url);
                        return -9; // timed out
                }
 
@@ -985,8 +985,8 @@ class DFRN
                }
 
                if (strpos($xml, '<?xml') === false) {
-                       Logger::log('No valid XML returned from ' . $contact['id'] . ' - ' . $dest_url);
-                       Logger::log('Returned XML: ' . $xml, Logger::DATA);
+                       Logger::notice('No valid XML returned from ' . $contact['id'] . ' - ' . $dest_url);
+                       Logger::debug('Returned XML: ' . $xml);
                        return 3;
                }
 
@@ -997,7 +997,7 @@ class DFRN
                }
 
                if (!empty($res->message)) {
-                       Logger::log('Transmit to ' . $dest_url . ' returned status '.$res->status.' - '.$res->message, Logger::DEBUG);
+                       Logger::info('Transmit to ' . $dest_url . ' returned status '.$res->status.' - '.$res->message);
                }
 
                return intval($res->status);
@@ -1088,12 +1088,12 @@ class DFRN
                }
 
                if (empty($author['avatar'])) {
-                       Logger::log('Empty author: ' . $xml);
+                       Logger::notice('Empty author: ' . $xml);
                        $author['avatar'] = '';
                }
 
                if (DBA::isResult($contact_old) && !$onlyfetch) {
-                       Logger::log("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.", Logger::DEBUG);
+                       Logger::info("Check if contact details for contact " . $contact_old["id"] . " (" . $contact_old["nick"] . ") have to be updated.");
 
                        $poco = ["url" => $contact_old["url"], "network" => $contact_old["network"]];
 
@@ -1154,7 +1154,7 @@ class DFRN
                        // If the "hide" element is present then the profile isn't searchable.
                        $hide = intval(XML::getFirstNodeValue($xpath, $element . "/dfrn:hide/text()", $context) == "true");
 
-                       Logger::log("Hidden status for contact " . $contact_old["url"] . ": " . $hide, Logger::DEBUG);
+                       Logger::info("Hidden status for contact " . $contact_old["url"] . ": " . $hide);
 
                        // If the contact isn't searchable then set the contact to "hidden".
                        // Problem: This can be manually overridden by the user.
@@ -1295,7 +1295,7 @@ class DFRN
         */
        private static function processMail($xpath, $mail, $importer)
        {
-               Logger::log("Processing mails");
+               Logger::notice("Processing mails");
 
                $msg = [];
                $msg["uid"] = $importer["importer_uid"];
@@ -1397,7 +1397,7 @@ class DFRN
         */
        private static function processRelocation($xpath, $relocation, $importer)
        {
-               Logger::log("Processing relocations");
+               Logger::notice("Processing relocations");
 
                /// @TODO Rewrite this to one statement
                $relocate = [];
@@ -1444,7 +1444,7 @@ class DFRN
 
                Contact::updateAvatar($importer["id"], $relocate["avatar"], true);
 
-               Logger::log('Contacts are updated.');
+               Logger::notice('Contacts are updated.');
 
                /// @TODO
                /// merge with current record, current contents have priority
@@ -1505,7 +1505,7 @@ class DFRN
                        if ($importer["page-flags"] == User::PAGE_FLAGS_COMMUNITY || $importer["page-flags"] == User::PAGE_FLAGS_PRVGROUP) {
                                $sql_extra = "";
                                $community = true;
-                               Logger::log("possible community action");
+                               Logger::notice("possible community action");
                        } else {
                                $sql_extra = " AND `self` AND `wall`";
                        }
@@ -1525,7 +1525,7 @@ class DFRN
                         */
                        if ($is_a_remote_action && $community && (!$parent["forum_mode"]) && (!$parent["wall"])) {
                                $is_a_remote_action = false;
-                               Logger::log("not a community action");
+                               Logger::notice("not a community action");
                        }
 
                        if ($is_a_remote_action) {
@@ -1606,7 +1606,7 @@ class DFRN
         */
        private static function processVerbs($entrytype, $importer, &$item, &$is_like)
        {
-               Logger::log("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, Logger::DEBUG);
+               Logger::info("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype);
 
                if (($entrytype == DFRN::TOP_LEVEL) && !empty($importer['id'])) {
                        // The filling of the the "contact" variable is done for legcy reasons
@@ -1618,22 +1618,22 @@ class DFRN
                        // Big question: Do we need these functions? They were part of the "consume_feed" function.
                        // This function once was responsible for DFRN and OStatus.
                        if ($activity->match($item["verb"], Activity::FOLLOW)) {
-                               Logger::log("New follower");
+                               Logger::notice("New follower");
                                Contact::addRelationship($importer, $contact, $item);
                                return false;
                        }
                        if ($activity->match($item["verb"], Activity::UNFOLLOW)) {
-                               Logger::log("Lost follower");
+                               Logger::notice("Lost follower");
                                Contact::removeFollower($contact);
                                return false;
                        }
                        if ($activity->match($item["verb"], Activity::REQ_FRIEND)) {
-                               Logger::log("New friend request");
+                               Logger::notice("New friend request");
                                Contact::addRelationship($importer, $contact, $item, true);
                                return false;
                        }
                        if ($activity->match($item["verb"], Activity::UNFRIEND)) {
-                               Logger::log("Lost sharer");
+                               Logger::notice("Lost sharer");
                                Contact::removeSharer($importer, $contact, $item);
                                return false;
                        }
@@ -1678,7 +1678,7 @@ class DFRN
                                        $item_tag = Post::selectFirst(['id', 'uri-id'], ['uri' => $xt->id, 'uid' => $importer["importer_uid"]]);
 
                                        if (!DBA::isResult($item_tag)) {
-                                               Logger::log("Query failed to execute, no result returned in " . __FUNCTION__);
+                                               Logger::notice("Query failed to execute, no result returned in " . __FUNCTION__);
                                                return false;
                                        }
 
@@ -1765,7 +1765,7 @@ class DFRN
         */
        private static function processEntry($header, $xpath, $entry, $importer, $xml, $protocol)
        {
-               Logger::log("Processing entries");
+               Logger::notice("Processing entries");
 
                $item = $header;
 
@@ -1783,7 +1783,7 @@ class DFRN
                );
                // Is there an existing item?
                if (DBA::isResult($current) && !self::isEditedTimestampNewer($current, $item)) {
-                       Logger::log("Item ".$item["uri"]." (".$item['edited'].") already existed.", Logger::DEBUG);
+                       Logger::info("Item ".$item["uri"]." (".$item['edited'].") already existed.");
                        return;
                }
 
@@ -1993,10 +1993,10 @@ class DFRN
 
                        // Is it an event?
                        if (($item["object-type"] == Activity\ObjectType::EVENT) && !$owner_unknown) {
-                               Logger::log("Item ".$item["uri"]." seems to contain an event.", Logger::DEBUG);
+                               Logger::info("Item ".$item["uri"]." seems to contain an event.");
                                $ev = Event::fromBBCode($item["body"]);
                                if ((!empty($ev['desc']) || !empty($ev['summary'])) && !empty($ev['start'])) {
-                                       Logger::log("Event in item ".$item["uri"]." was found.", Logger::DEBUG);
+                                       Logger::info("Event in item ".$item["uri"]." was found.");
                                        $ev["cid"]       = $importer["id"];
                                        $ev["uid"]       = $importer["importer_uid"];
                                        $ev["uri"]       = $item["uri"];
@@ -2024,13 +2024,13 @@ class DFRN
                }
 
                if (!self::processVerbs($entrytype, $importer, $item, $is_like)) {
-                       Logger::log("Exiting because 'processVerbs' told us so", Logger::DEBUG);
+                       Logger::info("Exiting because 'processVerbs' told us so");
                        return;
                }
 
                // This check is done here to be able to receive connection requests in "processVerbs"
                if (($entrytype == DFRN::TOP_LEVEL) && $owner_unknown) {
-                       Logger::log("Item won't be stored because user " . $importer["importer_uid"] . " doesn't follow " . $item["owner-link"] . ".", Logger::DEBUG);
+                       Logger::info("Item won't be stored because user " . $importer["importer_uid"] . " doesn't follow " . $item["owner-link"] . ".");
                        return;
                }
 
@@ -2038,9 +2038,9 @@ class DFRN
                // Update content if 'updated' changes
                if (DBA::isResult($current)) {
                        if (self::updateContent($current, $item, $importer, $entrytype)) {
-                               Logger::log("Item ".$item["uri"]." was updated.", Logger::DEBUG);
+                               Logger::info("Item ".$item["uri"]." was updated.");
                        } else {
-                               Logger::log("Item " . $item["uri"] . " already existed.", Logger::DEBUG);
+                               Logger::info("Item " . $item["uri"] . " already existed.");
                        }
                        return;
                }
@@ -2053,7 +2053,7 @@ class DFRN
 
                        $posted_id = Item::insert($item);
                        if ($posted_id) {
-                               Logger::log("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id, Logger::DEBUG);
+                               Logger::info("Reply from contact ".$item["contact-id"]." was stored with id ".$posted_id);
 
                                if ($item['uid'] == 0) {
                                        Item::distribute($posted_id);
@@ -2063,7 +2063,7 @@ class DFRN
                        }
                } else { // $entrytype == DFRN::TOP_LEVEL
                        if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) {
-                               Logger::log("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", Logger::DEBUG);
+                               Logger::info("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.");
                                return;
                        }
                        if (!Strings::compareLink($item["owner-link"], $importer["url"])) {
@@ -2073,13 +2073,13 @@ class DFRN
                                 * the tgroup delivery code called from Item::insert will correct it if it's a forum,
                                 * but we're going to unconditionally correct it here so that the post will always be owned by our contact.
                                 */
-                               Logger::log('Correcting item owner.', Logger::DEBUG);
+                               Logger::info('Correcting item owner.');
                                $item["owner-link"] = $importer["url"];
                                $item["owner-id"] = Contact::getIdForURL($importer["url"], 0);
                        }
 
                        if (($importer["rel"] == Contact::FOLLOWER) && (!self::tgroupCheck($importer["importer_uid"], $item))) {
-                               Logger::log("Contact ".$importer["id"]." is only follower and tgroup check was negative.", Logger::DEBUG);
+                               Logger::info("Contact ".$importer["id"]." is only follower and tgroup check was negative.");
                                return;
                        }
 
@@ -2093,7 +2093,7 @@ class DFRN
                                $posted_id = $notify;
                        }
 
-                       Logger::log("Item was stored with id ".$posted_id, Logger::DEBUG);
+                       Logger::info("Item was stored with id ".$posted_id);
 
                        if ($item['uid'] == 0) {
                                Item::distribute($posted_id);
@@ -2118,7 +2118,7 @@ class DFRN
         */
        private static function processDeletion($xpath, $deletion, $importer)
        {
-               Logger::log("Processing deletions");
+               Logger::notice("Processing deletions");
                $uri = null;
 
                foreach ($deletion->attributes as $attributes) {
@@ -2134,7 +2134,7 @@ class DFRN
                $condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
                $item = Post::selectFirst(['id', 'parent', 'contact-id', 'uri-id', 'deleted', 'gravity'], $condition);
                if (!DBA::isResult($item)) {
-                       Logger::log("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", Logger::DEBUG);
+                       Logger::info("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.");
                        return;
                }
 
@@ -2145,7 +2145,7 @@ class DFRN
 
                // When it is a starting post it has to belong to the person that wants to delete it
                if (($item['gravity'] == GRAVITY_PARENT) && ($item['contact-id'] != $importer["id"])) {
-                       Logger::log("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.", Logger::DEBUG);
+                       Logger::info("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.");
                        return;
                }
 
@@ -2153,7 +2153,7 @@ class DFRN
                if (($item['gravity'] != GRAVITY_PARENT) && ($item['contact-id'] != $importer["id"])) {
                        $condition = ['id' => $item['parent'], 'contact-id' => $importer["id"]];
                        if (!Post::exists($condition)) {
-                               Logger::log("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.", Logger::DEBUG);
+                               Logger::info("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.");
                                return;
                        }
                }
@@ -2162,7 +2162,7 @@ class DFRN
                        return;
                }
 
-               Logger::log('deleting item '.$item['id'].' uri='.$uri, Logger::DEBUG);
+               Logger::info('deleting item '.$item['id'].' uri='.$uri);
 
                Item::markForDeletion(['id' => $item['id']]);
        }
@@ -2224,7 +2224,7 @@ class DFRN
                        self::fetchauthor($xpath, $doc->firstChild, $importer, "dfrn:owner", false, $xml);
                }
 
-               Logger::log("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"], Logger::DEBUG);
+               Logger::info("Import DFRN message for user " . $importer["importer_uid"] . " from contact " . $importer["id"]);
 
                if (!empty($importer['gsid']) && ($protocol == Conversation::PARCEL_DIASPORA_DFRN)) {
                        GServer::setProtocol($importer['gsid'], Post\DeliveryData::DFRN);
@@ -2307,7 +2307,7 @@ class DFRN
                        self::processEntry($header, $xpath, $entry, $importer, $xml, $protocol);
                }
 
-               Logger::log("Import done for user " . $importer["importer_uid"] . " from contact " . $importer["id"], Logger::DEBUG);
+               Logger::info("Import done for user " . $importer["importer_uid"] . " from contact " . $importer["id"]);
                return 200;
        }
 
@@ -2357,7 +2357,7 @@ class DFRN
                        foreach ($matches as $mtch) {
                                if (Strings::compareLink($link, $mtch[1]) || Strings::compareLink($dlink, $mtch[1])) {
                                        $mention = true;
-                                       Logger::log('mention found: ' . $mtch[2]);
+                                       Logger::notice('mention found: ' . $mtch[2]);
                                }
                        }
                }
index 7e17ab9f98e5179c5b23d0a9e40cd4462a2a2f1d..277644dcc9a01a5d190e25ebebcff3499a32fd33 100644 (file)
@@ -212,7 +212,7 @@ class OStatus
                        Contact::update($contact, ['id' => $contact["id"]], $current);
 
                        if (!empty($author["author-avatar"]) && ($author["author-avatar"] != $current['avatar'])) {
-                               Logger::log("Update profile picture for contact ".$contact["id"], Logger::DEBUG);
+                               Logger::info("Update profile picture for contact ".$contact["id"]);
                                Contact::updateAvatar($contact["id"], $author["author-avatar"]);
                        }
 
@@ -336,7 +336,7 @@ class OStatus
                        self::$conv_list = [];
                }
 
-               Logger::log('Import OStatus message for user ' . $importer['uid'], Logger::DEBUG);
+               Logger::info('Import OStatus message for user ' . $importer['uid']);
 
                if ($xml == "") {
                        return false;
@@ -362,7 +362,7 @@ class OStatus
                                foreach ($hub_attributes as $hub_attribute) {
                                        if ($hub_attribute->name == "href") {
                                                $hub = $hub_attribute->textContent;
-                                               Logger::log("Found hub ".$hub, Logger::DEBUG);
+                                               Logger::info("Found hub ".$hub);
                                        }
                                }
                        }
@@ -440,27 +440,27 @@ class OStatus
 
                        if (in_array($item["verb"], [Activity::O_UNFAVOURITE, Activity::UNFAVORITE])) {
                                // Ignore "Unfavorite" message
-                               Logger::log("Ignore unfavorite message ".print_r($item, true), Logger::DEBUG);
+                               Logger::info("Ignore unfavorite message ", ['item' => $item]);
                                continue;
                        }
 
                        // Deletions come with the same uri, so we check for duplicates after processing deletions
                        if (Post::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]])) {
-                               Logger::log('Post with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', Logger::DEBUG);
+                               Logger::info('Post with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.');
                                continue;
                        } else {
-                               Logger::log('Processing post with URI '.$item["uri"].' for user '.$importer["uid"].'.', Logger::DEBUG);
+                               Logger::info('Processing post with URI '.$item["uri"].' for user '.$importer["uid"].'.');
                        }
 
                        if ($item["verb"] == Activity::JOIN) {
                                // ignore "Join" messages
-                               Logger::log("Ignore join message ".print_r($item, true), Logger::DEBUG);
+                               Logger::info("Ignore join message ", ['item' => $item]);
                                continue;
                        }
 
                        if ($item["verb"] == "http://mastodon.social/schema/1.0/block") {
                                // ignore mastodon "block" messages
-                               Logger::log("Ignore block message ".print_r($item, true), Logger::DEBUG);
+                               Logger::info("Ignore block message ", ['item' => $item]);
                                continue;
                        }
 
@@ -477,7 +477,7 @@ class OStatus
 
                        if ($item["verb"] == Activity::FAVORITE) {
                                $orig_uri = $xpath->query("activity:object/atom:id", $entry)->item(0)->nodeValue;
-                               Logger::log("Favorite ".$orig_uri." ".print_r($item, true));
+                               Logger::notice("Favorite", ['uri' => $orig_uri, 'item' => $item]);
 
                                $item["verb"] = Activity::LIKE;
                                $item["thr-parent"] = $orig_uri;
@@ -487,7 +487,7 @@ class OStatus
 
                        // http://activitystrea.ms/schema/1.0/rsvp-yes
                        if (!in_array($item["verb"], [Activity::POST, Activity::LIKE, Activity::SHARE])) {
-                               Logger::log("Unhandled verb ".$item["verb"]." ".print_r($item, true), Logger::DEBUG);
+                               Logger::info("Unhandled verb", ['verb' => $item["verb"], 'item' => $item]);
                        }
 
                        self::processPost($xpath, $entry, $item, $importer);
@@ -501,10 +501,10 @@ class OStatus
                                                // If not, then it depends on this setting
                                                $valid = ((self::$itemlist[0]['uid'] == 0) || !DI::pConfig()->get(self::$itemlist[0]['uid'], 'system', 'accept_only_sharer', false));
                                                if ($valid) {
-                                                       Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", Logger::DEBUG);
+                                                       Logger::info("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.");
                                                }
                                        } else {
-                                               Logger::log("Item with uri ".self::$itemlist[0]['uri']." belongs to a contact (".self::$itemlist[0]['contact-id']."). It will be imported.", Logger::DEBUG);
+                                               Logger::info("Item with uri ".self::$itemlist[0]['uri']." belongs to a contact (".self::$itemlist[0]['contact-id']."). It will be imported.");
                                        }
                                        if ($valid) {
                                                // Never post a thread when the only interaction by our contact was a like
@@ -516,7 +516,7 @@ class OStatus
                                                        }
                                                }
                                                if ($valid) {
-                                                       Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.", Logger::DEBUG);
+                                                       Logger::info("Item with uri ".self::$itemlist[0]['uri']." will be imported since the thread contains posts or shares.");
                                                }
                                        }
                                } else {
@@ -535,18 +535,18 @@ class OStatus
                                        foreach (self::$itemlist as $item) {
                                                $found = Post::exists(['uid' => $importer["uid"], 'uri' => $item["uri"]]);
                                                if ($found) {
-                                                       Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already exists.", Logger::DEBUG);
+                                                       Logger::info("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already exists.");
                                                } elseif ($item['contact-id'] < 0) {
-                                                       Logger::log("Item with uri ".$item["uri"]." is from a blocked contact.", Logger::DEBUG);
+                                                       Logger::info("Item with uri ".$item["uri"]." is from a blocked contact.");
                                                } else {
                                                        $ret = Item::insert($item);
-                                                       Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
+                                                       Logger::notice("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
                                                }
                                        }
                                }
                                self::$itemlist = [];
                        }
-                       Logger::log('Processing done for post with URI '.$item["uri"].' for user '.$importer["uid"].'.', Logger::DEBUG);
+                       Logger::info('Processing done for post with URI '.$item["uri"].' for user '.$importer["uid"].'.');
                }
                return true;
        }
@@ -562,13 +562,13 @@ class OStatus
        {
                $condition = ['uid' => $item['uid'], 'author-id' => $item['author-id'], 'uri' => $item['uri']];
                if (!Post::exists($condition)) {
-                       Logger::log('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it.");
+                       Logger::notice('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it.");
                        return;
                }
 
                Item::markForDeletion($condition);
 
-               Logger::log('Deleted item with uri '.$item['uri'].' for user '.$item['uid']);
+               Logger::notice('Deleted item with uri '.$item['uri'].' for user '.$item['uid']);
        }
 
        /**
@@ -697,7 +697,7 @@ class OStatus
                                        self::fetchRelated($related, $item["thr-parent"], $importer);
                                }
                        } else {
-                               Logger::log('Reply with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.', Logger::DEBUG);
+                               Logger::info('Reply with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.');
                        }
                } else {
                        $item["thr-parent"] = $item["uri"];
@@ -845,7 +845,7 @@ class OStatus
 
                        $conv_data['source'] = $doc2->saveXML();
 
-                       Logger::log('Store conversation data for uri '.$conv_data['uri'], Logger::DEBUG);
+                       Logger::info('Store conversation data for uri '.$conv_data['uri']);
                        Conversation::insert($conv_data);
                }
        }
@@ -868,7 +868,7 @@ class OStatus
                        Conversation::PARCEL_DIASPORA_DFRN, Conversation::PARCEL_LEGACY_DFRN,
                        Conversation::PARCEL_LOCAL_DFRN, Conversation::PARCEL_DIRECT, Conversation::PARCEL_SALMON]];
                if (DBA::exists('conversation', $condition)) {
-                       Logger::log('Conversation '.$item['uri'].' is already stored.', Logger::DEBUG);
+                       Logger::info('Conversation '.$item['uri'].' is already stored.');
                        return;
                }
 
@@ -889,7 +889,7 @@ class OStatus
                $item["source"] = $xml;
                $item["direction"] = Conversation::PULL;
 
-               Logger::log('Conversation '.$item['uri'].' is now fetched.', Logger::DEBUG);
+               Logger::info('Conversation '.$item['uri'].' is now fetched.');
        }
 
        /**
@@ -912,11 +912,11 @@ class OStatus
                        $stored = true;
                        $xml = $conversation['source'];
                        if (self::process($xml, $importer, $contact, $hub, $stored, false, Conversation::PULL)) {
-                               Logger::log('Got valid cached XML for URI '.$related_uri, Logger::DEBUG);
+                               Logger::info('Got valid cached XML for URI '.$related_uri);
                                return;
                        }
                        if ($conversation['protocol'] == Conversation::PARCEL_SALMON) {
-                               Logger::log('Delete invalid cached XML for URI '.$related_uri, Logger::DEBUG);
+                               Logger::info('Delete invalid cached XML for URI '.$related_uri);
                                DBA::delete('conversation', ['item-uri' => $related_uri]);
                        }
                }
@@ -932,7 +932,7 @@ class OStatus
 
                if ($curlResult->inHeader('Content-Type') &&
                        in_array('application/atom+xml', $curlResult->getHeader('Content-Type'))) {
-                       Logger::log('Directly fetched XML for URI ' . $related_uri, Logger::DEBUG);
+                       Logger::info('Directly fetched XML for URI ' . $related_uri);
                        $xml = $curlResult->getBody();
                }
 
@@ -957,7 +957,7 @@ class OStatus
                                        $curlResult = DI::httpClient()->get($atom_file);
 
                                        if ($curlResult->isSuccess()) {
-                                               Logger::log('Fetched XML for URI ' . $related_uri, Logger::DEBUG);
+                                               Logger::info('Fetched XML for URI ' . $related_uri);
                                                $xml = $curlResult->getBody();
                                        }
                                }
@@ -969,7 +969,7 @@ class OStatus
                        $curlResult = DI::httpClient()->get(str_replace('/notice/', '/api/statuses/show/', $related) . '.atom');
 
                        if ($curlResult->isSuccess()) {
-                               Logger::log('GNU Social workaround to fetch XML for URI ' . $related_uri, Logger::DEBUG);
+                               Logger::info('GNU Social workaround to fetch XML for URI ' . $related_uri);
                                $xml = $curlResult->getBody();
                        }
                }
@@ -980,7 +980,7 @@ class OStatus
                        $curlResult = DI::httpClient()->get(str_replace('/notice/', '/api/statuses/show/', $related_guess) . '.atom');
 
                        if ($curlResult->isSuccess()) {
-                               Logger::log('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, Logger::DEBUG);
+                               Logger::info('GNU Social workaround 2 to fetch XML for URI ' . $related_uri);
                                $xml = $curlResult->getBody();
                        }
                }
@@ -991,7 +991,7 @@ class OStatus
                        $conversation = DBA::selectFirst('conversation', ['source'], $condition);
                        if (DBA::isResult($conversation)) {
                                $stored = true;
-                               Logger::log('Got cached XML from conversation for URI '.$related_uri, Logger::DEBUG);
+                               Logger::info('Got cached XML from conversation for URI '.$related_uri);
                                $xml = $conversation['source'];
                        }
                }
@@ -999,7 +999,7 @@ class OStatus
                if ($xml != '') {
                        self::process($xml, $importer, $contact, $hub, $stored, false, Conversation::PULL);
                } else {
-                       Logger::log("XML couldn't be fetched for URI: ".$related_uri." - href: ".$related, Logger::DEBUG);
+                       Logger::info("XML couldn't be fetched for URI: ".$related_uri." - href: ".$related);
                }
                return;
        }
@@ -1536,7 +1536,7 @@ class OStatus
        private static function likeEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
        {
                if (($item['gravity'] != GRAVITY_PARENT) && (Strings::normaliseLink($item["author-link"]) != Strings::normaliseLink($owner["url"]))) {
-                       Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
+                       Logger::info("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.");
                }
 
                $entry = self::entryHeader($doc, $owner, $item, $toplevel);
@@ -1685,7 +1685,7 @@ class OStatus
        private static function noteEntry(DOMDocument $doc, array $item, array $owner, $toplevel)
        {
                if (($item['gravity'] != GRAVITY_PARENT) && (Strings::normaliseLink($item["author-link"]) != Strings::normaliseLink($owner["url"]))) {
-                       Logger::log("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", Logger::DEBUG);
+                       Logger::info("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.");
                }
 
                if (!$toplevel) {
@@ -1983,7 +1983,7 @@ class OStatus
                if ((time() - strtotime($owner['last-item'])) < 15*60) {
                        $result = DI::cache()->get($cachekey);
                        if (!$nocache && !is_null($result)) {
-                               Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created . ' (cached)', Logger::DEBUG);
+                               Logger::info('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created . ' (cached)');
                                $last_update = $result['last_update'];
                                return $result['feed'];
                        }
@@ -2048,7 +2048,7 @@ class OStatus
                $msg = ['feed' => $feeddata, 'last_update' => $last_update];
                DI::cache()->set($cachekey, $msg, Duration::QUARTER_HOUR);
 
-               Logger::log('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created, Logger::DEBUG);
+               Logger::info('Feed duration: ' . number_format(microtime(true) - $stamp, 3) . ' - ' . $owner_nick . ' - ' . $filter . ' - ' . $previous_created);
 
                return $feeddata;
        }
index 95bddcd6553b5d6c4e0efb7e428d5c6de086466d..ebb9f1776df46a2bf2caf13eac3d8dd03345aa19 100644 (file)
@@ -46,7 +46,7 @@ class Salmon
        {
                $ret = [];
 
-               Logger::log('Fetching salmon key for '.$uri);
+               Logger::notice('Fetching salmon key for '.$uri);
 
                $arr = Probe::lrdd($uri);
 
@@ -116,12 +116,12 @@ class Salmon
                }
 
                if (!$owner['sprvkey']) {
-                       Logger::log(sprintf("user '%s' (%d) does not have a salmon private key. Send failed.",
+                       Logger::notice(sprintf("user '%s' (%d) does not have a salmon private key. Send failed.",
                        $owner['name'], $owner['uid']));
                        return;
                }
 
-               Logger::log('slapper called for '.$url.'. Data: ' . $slap);
+               Logger::notice('slapper called for '.$url.'. Data: ' . $slap);
 
                // create a magic envelope
 
@@ -165,7 +165,7 @@ class Salmon
                // check for success, e.g. 2xx
 
                if ($return_code > 299) {
-                       Logger::log('GNU Social salmon failed. Falling back to compliant mode');
+                       Logger::notice('GNU Social salmon failed. Falling back to compliant mode');
 
                        // Now try the compliant mode that normally isn't used for GNU Social
                        $xmldata = ["me:env" => ["me:data" => $data,
@@ -188,7 +188,7 @@ class Salmon
                }
 
                if ($return_code > 299) {
-                       Logger::log('compliant salmon failed. Falling back to old status.net');
+                       Logger::notice('compliant salmon failed. Falling back to old status.net');
 
                        // Last try. This will most likely fail as well.
                        $xmldata = ["me:env" => ["me:data" => $data,
@@ -209,7 +209,7 @@ class Salmon
                        $return_code = $postResult->getReturnCode();
                }
 
-               Logger::log('slapper for '.$url.' returned ' . $return_code);
+               Logger::notice('slapper for '.$url.' returned ' . $return_code);
 
                if (! $return_code) {
                        return -1;
index b3ae2d69b8442cad3c819f8cf2935e3f9d728889..5f2fee3be8f5698cfe72b822f2fe70bfeccc33de 100644 (file)
@@ -136,7 +136,7 @@ class Crypto
                $result = openssl_pkey_new($openssl_options);
 
                if (empty($result)) {
-                       Logger::log('new_keypair: failed');
+                       Logger::notice('new_keypair: failed');
                        return false;
                }
 
@@ -261,7 +261,7 @@ class Crypto
        private static function encapsulateOther($data, $pubkey, $alg)
        {
                if (!$pubkey) {
-                       Logger::log('no key. data: '.$data);
+                       Logger::notice('no key. data: '.$data);
                }
                $fn = 'encrypt' . strtoupper($alg);
                if (method_exists(__CLASS__, $fn)) {
@@ -303,7 +303,7 @@ class Crypto
        private static function encapsulateAes($data, $pubkey)
        {
                if (!$pubkey) {
-                       Logger::log('aes_encapsulate: no key. data: ' . $data);
+                       Logger::notice('aes_encapsulate: no key. data: ' . $data);
                }
 
                $key = random_bytes(32);
@@ -314,7 +314,7 @@ class Crypto
                // log the offending call so we can track it down
                if (!openssl_public_encrypt($key, $k, $pubkey)) {
                        $x = debug_backtrace();
-                       Logger::log('aes_encapsulate: RSA failed. ' . print_r($x[0], true));
+                       Logger::notice('aes_encapsulate: RSA failed.', ['data' => $x[0]]);
                }
 
                $result['alg'] = 'aes256cbc';
index fdb49dabdceeef7a1212b21b4ee7b245146d01ef..cf3216a152c8c5ebc3b2cfdf8758f719feeeaf46 100644 (file)
@@ -157,7 +157,7 @@ class DateTimeFormat
                try {
                        $d = new DateTime($s, $from_obj);
                } catch (Exception $e) {
-                       Logger::log('DateTimeFormat::convert: exception: ' . $e->getMessage());
+                       Logger::notice('DateTimeFormat::convert: exception: ' . $e->getMessage());
                        $d = new DateTime('now', $from_obj);
                }
 
index 89cb0452a3c2a1b0a8b93c798587e1d19e71c0e9..f11dbcceb4c20c73505d0fe9aa007e5a774f2721 100644 (file)
@@ -80,7 +80,7 @@ class HTTPSignature
                $sig_block = self::parseSigheader($headers['authorization']);
 
                if (!$sig_block) {
-                       Logger::log('no signature provided.');
+                       Logger::notice('no signature provided.');
                        return $result;
                }
 
@@ -110,7 +110,7 @@ class HTTPSignature
                        $key = $key($sig_block['keyId']);
                }
 
-               Logger::log('Got keyID ' . $sig_block['keyId'], Logger::DEBUG);
+               Logger::info('Got keyID ' . $sig_block['keyId']);
 
                if (!$key) {
                        return $result;
@@ -118,7 +118,7 @@ class HTTPSignature
 
                $x = Crypto::rsaVerify($signed_data, $sig_block['signature'], $key, $algorithm);
 
-               Logger::log('verified: ' . $x, Logger::DEBUG);
+               Logger::info('verified: ' . $x);
 
                if (!$x) {
                        return $result;
@@ -308,7 +308,7 @@ class HTTPSignature
                $postResult = DI::httpClient()->post($target, $content, $headers);
                $return_code = $postResult->getReturnCode();
 
-               Logger::log('Transmit to ' . $target . ' returned ' . $return_code, Logger::DEBUG);
+               Logger::info('Transmit to ' . $target . ' returned ' . $return_code);
 
                $success = ($return_code >= 200) && ($return_code <= 299);
 
@@ -459,7 +459,7 @@ class HTTPSignature
                }
                $return_code = $curlResult->getReturnCode();
 
-               Logger::log('Fetched for user ' . $uid . ' from ' . $request . ' returned ' . $return_code, Logger::DEBUG);
+               Logger::info('Fetched for user ' . $uid . ' from ' . $request . ' returned ' . $return_code);
 
                return $curlResult;
        }
@@ -604,7 +604,7 @@ class HTTPSignature
                if (in_array('date', $sig_block['headers'])) {
                        $diff = abs(strtotime($headers['date']) - time());
                        if ($diff > 300) {
-                               Logger::log("Header date '" . $headers['date'] . "' is with " . $diff . " seconds out of the 300 second frame. The signature is invalid.");
+                               Logger::notice("Header date '" . $headers['date'] . "' is with " . $diff . " seconds out of the 300 second frame. The signature is invalid.");
                                return false;
                        }
                        $hasGoodSignedContent = true;
index 0b10687c9d5a64f3a5e8ceef166d04002cec7293..9c7b6a8af8890957e5894a705798b79db5de52da 100644 (file)
@@ -268,7 +268,7 @@ class Network
                        $avatar['url'] = DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO;
                }
 
-               Logger::log('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], Logger::DEBUG);
+               Logger::info('Avatar: ' . $avatar['email'] . ' ' . $avatar['url']);
                return $avatar['url'];
        }
 
index 196718654d8f4bac76529a820a1c0feb345abaa2..2f27e4a5ff9b1cbb91f358bf7b64a572123e0d49 100644 (file)
@@ -284,7 +284,7 @@ class Strings
        public static function base64UrlDecode($s)
        {
                if (is_array($s)) {
-                       Logger::log('base64url_decode: illegal input: ' . print_r(debug_backtrace(), true));
+                       Logger::notice('base64url_decode: illegal input: ', ['backtrace' => debug_backtrace()]);
                        return $s;
                }
 
index 7b4539ba8cdd10a066ba44c52730d432ddb90168..df3e913f5675ed2dd641a130b41c574912983632 100644 (file)
@@ -268,7 +268,7 @@ class XML
                }
 
                if (!function_exists('xml_parser_create')) {
-                       Logger::log('Xml::toArray: parser function missing');
+                       Logger::notice('Xml::toArray: parser function missing');
                        return [];
                }
 
@@ -283,7 +283,7 @@ class XML
                }
 
                if (! $parser) {
-                       Logger::log('Xml::toArray: xml_parser_create: no resource');
+                       Logger::notice('Xml::toArray: xml_parser_create: no resource');
                        return [];
                }
 
@@ -295,9 +295,9 @@ class XML
                @xml_parser_free($parser);
 
                if (! $xml_values) {
-                       Logger::log('Xml::toArray: libxml: parse error: ' . $contents, Logger::DATA);
+                       Logger::debug('Xml::toArray: libxml: parse error: ' . $contents);
                        foreach (libxml_get_errors() as $err) {
-                               Logger::log('libxml: parse: ' . $err->code . " at " . $err->line . ":" . $err->column . " : " . $err->message, Logger::DATA);
+                               Logger::debug('libxml: parse: ' . $err->code . " at " . $err->line . ":" . $err->column . " : " . $err->message);
                        }
                        libxml_clear_errors();
                        return;
index 6f764a72dbd959c122b58c5927c4843de7e0ae71..134ddaabad309bbdaa71fdd5e68bc52ac885182d 100644 (file)
@@ -35,7 +35,7 @@ class CheckVersion
 {
        public static function execute()
        {
-               Logger::log('checkversion: start');
+               Logger::notice('checkversion: start');
 
                $checkurl = DI::config()->get('system', 'check_new_version_url', 'none');
 
@@ -51,15 +51,15 @@ class CheckVersion
                                // don't check
                                return;
                }
-               Logger::log("Checking VERSION from: ".$checked_url, Logger::DEBUG);
+               Logger::info("Checking VERSION from: ".$checked_url);
 
                // fetch the VERSION file
                $gitversion = DBA::escape(trim(DI::httpClient()->fetch($checked_url)));
-               Logger::log("Upstream VERSION is: ".$gitversion, Logger::DEBUG);
+               Logger::notice("Upstream VERSION is: ".$gitversion);
 
                DI::config()->set('system', 'git_friendica_version', $gitversion);
 
-               Logger::log('checkversion: end');
+               Logger::notice('checkversion: end');
 
                return;
        }
index 3dcaa7205bf3cca6e6ed6add49baa5379bd53c8c..7b098bc9480a68e83f5c22fe545e95158ec40cd4 100644 (file)
@@ -51,7 +51,7 @@ class Directory
 
                Hook::callAll('globaldir_update', $arr);
 
-               Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG);
+               Logger::info('Updating directory: ' . $arr['url']);
                if (strlen($arr['url'])) {
                        DI::httpClient()->fetch($dir . '?url=' . bin2hex($arr['url']));
                }
index e9e9afe8d2c9e11c2be988d600f8d06605388626..d353b5510065d2b3dc9015b59c3695ce34d2e2e0 100644 (file)
@@ -41,7 +41,7 @@ class ProfileUpdate {
                $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
 
                foreach ($inboxes as $inbox => $receivers) {
-                       Logger::log('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub', Logger::DEBUG);
+                       Logger::info('Profile update for user ' . $uid . ' to ' . $inbox .' via ActivityPub');
                        Worker::add(['priority' => $a->getQueueValue('priority'), 'created' => $a->getQueueValue('created'), 'dont_fork' => true],
                                'APDelivery', Delivery::PROFILEUPDATE, 0, $inbox, $uid, $receivers);
                }
index f9c311b2d9f5243842612e9fea2521d5d8c92adc..4b1c78bf2dee3da2bf0aa1b26316c714be78e21f 100644 (file)
@@ -48,7 +48,7 @@ class PubSubPublish
                /// @todo Check server status with GServer::check()
                // Before this can be done we need a way to safely detect the server url.
 
-               Logger::log("Generate feed of user " . $subscriber['nickname']. " to " . $subscriber['callback_url']. " - last updated " . $subscriber['last_update'], Logger::DEBUG);
+               Logger::info("Generate feed of user " . $subscriber['nickname']. " to " . $subscriber['callback_url']. " - last updated " . $subscriber['last_update']);
 
                $last_update = $subscriber['last_update'];
                $params = OStatus::feed($subscriber['nickname'], $last_update);
@@ -66,17 +66,17 @@ class PubSubPublish
                                        $subscriber['topic']),
                        'X-Hub-Signature' => 'sha1=' . $hmac_sig];
 
-               Logger::log('POST ' . print_r($headers, true) . "\n" . $params, Logger::DATA);
+               Logger::debug('POST ' . ['headers' => $headers, 'params' => $params]);
 
                $postResult = DI::httpClient()->post($subscriber['callback_url'], $params, $headers);
                $ret = $postResult->getReturnCode();
 
                if ($ret >= 200 && $ret <= 299) {
-                       Logger::log('Successfully pushed to ' . $subscriber['callback_url']);
+                       Logger::notice('Successfully pushed to ' . $subscriber['callback_url']);
 
                        PushSubscriber::reset($subscriber['id'], $last_update);
                } else {
-                       Logger::log('Delivery error when pushing to ' . $subscriber['callback_url'] . ' HTTP: ' . $ret);
+                       Logger::notice('Delivery error when pushing to ' . $subscriber['callback_url'] . ' HTTP: ' . $ret);
 
                        PushSubscriber::delay($subscriber['id']);
                }
index 961eb2a5eb20a978cfe21eeff51b1b9c40e1caaa..9315934970c36e19040cd759f4dee2156ee4dfdc 100644 (file)
@@ -57,7 +57,7 @@ function frio_install()
        Hook::register('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav');
        Hook::register('display_item', 'view/theme/frio/theme.php', 'frio_display_item');
 
-       Logger::log('installed theme frio');
+       Logger::notice('installed theme frio');
 }
 
 /**
index 6ae61fd95566c7c657d116bee1f2de00a7ba2c80..a1b492b95050afc7d8a854d276869265bbe14657 100644 (file)
@@ -49,7 +49,7 @@ foreach (['style', $style] as $file) {
                }
        } else {
                //TODO: use Logger::ERROR?
-               Logger::log('Error: missing file: "' . $stylecssfile .'" (userid: '. $uid .')');
+               Logger::notice('Error: missing file: "' . $stylecssfile .'" (userid: '. $uid .')');
        }
 }
 $modified = gmdate('r', $modified);