From 9d2c8902d37e5f47add0051df3e527cabef7829f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 21 Jun 2020 16:14:08 -0400 Subject: [PATCH] [twitter] Improve logging for actions --- twitter/twitter.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index 5167e022..d4702379 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -491,24 +491,25 @@ function twitter_action(App $a, $uid, $pid, $action) $post = ['id' => $pid]; - Logger::log("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), Logger::DATA); + Logger::debug('before action', ['action' => $action, 'pid' => $pid, 'data' => $post]); switch ($action) { - case "delete": + case 'delete': // To-Do: $result = $connection->post('statuses/destroy', $post); $result = []; break; - case "like": + case 'like': $result = $connection->post('favorites/create', $post); break; - case "unlike": + case 'unlike': $result = $connection->post('favorites/destroy', $post); break; default: - Logger::log('Unhandled action ' . $action, Logger::DEBUG); + Logger::warning('Unhandled action', ['action' => $action]); $result = []; } - Logger::log("twitter_action '" . $action . "' send, result: " . print_r($result, true), Logger::DEBUG); + + Logger::info('after action', ['action' => $action, 'result' => $result]); } function twitter_post_hook(App $a, array &$b)