From 27dce51a6914594b4ae958da91c24004497f1138 Mon Sep 17 00:00:00 2001 From: Thomas Fini Hansen Date: Wed, 19 Aug 2020 08:35:06 +0200 Subject: [PATCH] Fix watchdog logging When logging with watchdog, the message is assumed to be a translatable string. But debugging produces messages too big for the translation system to handle. This changes the message to use a placeholder and add the debug message as a variable. --- lib/log/TingClientDrupalWatchDogLogger.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/log/TingClientDrupalWatchDogLogger.php b/lib/log/TingClientDrupalWatchDogLogger.php index 8e2ff26..9f10a2d 100644 --- a/lib/log/TingClientDrupalWatchDogLogger.php +++ b/lib/log/TingClientDrupalWatchDogLogger.php @@ -6,10 +6,23 @@ * @see http://api.drupal.org/api/function/watchdog/ */ class TingClientDrupalWatchDogLogger extends TingClientLogger { + + /** + * Log a message to the Drupal watchdog. + * + * @param string $message + * Message to log. + * @param string $severity + * Severity to log with. + */ public function doLog($message, $severity) { - watchdog('ting client', htmlspecialchars($message, ENT_QUOTES, 'UTF-8', FALSE), array(), - constant('WATCHDOG_' . $severity), - 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); + watchdog( + 'ting client', + '
@message
', + ['@message' => $message], + constant('WATCHDOG_' . $severity), + 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] + ); } -} +}