From 0006d838f578e1e9e9883e224d459480daacf57b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 26 Jan 2025 14:09:21 -0500 Subject: [PATCH] Remove potential new lines in reported logger instances - Thanks to @MrKaplan-lw for the investigative work --- src/Navigation/Notifications/Repository/Notify.php | 4 +--- src/Protocol/Delivery.php | 2 +- src/Protocol/Diaspora.php | 2 +- src/Util/Emailer.php | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Navigation/Notifications/Repository/Notify.php b/src/Navigation/Notifications/Repository/Notify.php index e43c759901..3e4df1e77b 100644 --- a/src/Navigation/Notifications/Repository/Notify.php +++ b/src/Navigation/Notifications/Repository/Notify.php @@ -599,9 +599,7 @@ class Notify extends BaseRepository DBA::insert('notify-threads', $fields); $emailBuilder->setHeader('Message-ID', $message_id); - $log_msg = "No previous notification found for this parent:\n" . - " parent: {$params['parent']}\n" . " uid : {$params['uid']}\n"; - $this->logger->info($log_msg); + $this->logger->info('No previous notification found for this parent', ['parent' => $params['parent'], 'uid' => $params['uid']]); } else { // If not, just "follow" the thread. $emailBuilder->setHeader('References', $message_id); diff --git a/src/Protocol/Delivery.php b/src/Protocol/Delivery.php index 6755f645d6..d99b67c9a8 100644 --- a/src/Protocol/Delivery.php +++ b/src/Protocol/Delivery.php @@ -310,7 +310,7 @@ class Delivery $atom = DFRN::entries($msgitems, $owner); } - DI::logger()->debug('Notifier entry: ' . $contact['url'] . ' ' . ($target_item_id ?? 'relocation') . ' entry: ' . $atom); + DI::logger()->debug('Notifier entry', ['url' => $contact['url'], 'target_item_id' => ($target_item_id ?? 'relocation'), 'entry' => $atom]); $protocol = Post\DeliveryData::DFRN; diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 0235cb2f3f..a8db02f045 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -2790,7 +2790,7 @@ class Diaspora */ public static function encodePrivateData(string $msg, array $user, array $contact, string $prvkey, string $pubkey): string { - DI::logger()->debug('Message: ' . $msg); + DI::logger()->debug('Diaspora message', ['msg' => $msg]); // without a public key nothing will work if (!$pubkey) { diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index 0dc9f48f09..1f0ded46cf 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -207,8 +207,7 @@ class Emailer $hookdata['parameters'] ); - $this->logger->debug('header ' . 'To: ' . $email->getToAddress() . '\n' . $messageHeader); - $this->logger->debug('return value ' . (($res) ? 'true' : 'false')); + $this->logger->debug('Email message header', ['To' => $email->getToAddress(), 'messageHeader' => $messageHeader, 'return' => ($res) ? 'true' : 'false']); return $res; }