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