From d55a8337717fdff8336b29a771c48bc6d0ec9c1b Mon Sep 17 00:00:00 2001 From: Osamu Takiya Date: Sun, 6 Jun 2021 14:01:12 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Logger=20=E5=87=BA?= =?UTF-8?q?=E5=8A=9B=E6=99=82=E3=81=AB=E4=BB=BB=E6=84=8F=E3=81=AE=E3=83=8F?= =?UTF-8?q?=E3=83=83=E3=82=B7=E3=83=A5=E3=82=92=E6=B8=A1=E3=81=9B=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F=20(#83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../write_to_response_api_sheet_by_hashtag.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/lib/google_sheet_api/write_to_response_api_sheet_by_hashtag.rb b/app/lib/google_sheet_api/write_to_response_api_sheet_by_hashtag.rb index b58910f..61ade4b 100644 --- a/app/lib/google_sheet_api/write_to_response_api_sheet_by_hashtag.rb +++ b/app/lib/google_sheet_api/write_to_response_api_sheet_by_hashtag.rb @@ -17,16 +17,15 @@ def initialize(spreadsheet_id: nil, sheet_name: nil) set_basic_valiables end - def execute(hashtag, options={}) + def execute(hashtag, options={}, logger_options={}) update_target_tweets = target_tweets(hashtag, options) - Rails.logger.info( - LoggerMethods.convert_hash_to_json( - hashtag: hashtag, - message: 'update_target_tweets', - tweets: LoggerMethods.convert_tweet_objects_to_array(update_target_tweets) - ) - ) + merged_logger_options = { + hashtag: hashtag, + message: 'update_target_tweets', + tweets: LoggerMethods.convert_tweet_objects_to_array(update_target_tweets) + }.merge(logger_options) + Rails.logger.info(LoggerMethods.convert_hash_to_json(merged_logger_options)) update_data(update_target_tweets) rescue StandardError => e