From bf6192113aed4c5eac3c8c6eb56a97e3d62f7fd4 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 20 Mar 2018 18:47:49 +0100 Subject: [PATCH] Improved overall performance by using logger.debug { ... } instead of logger.debug(...). This decreases the LDAP import dry runtime by ~33%. --- .../application_controller/authenticates.rb | 10 ++--- app/controllers/long_polling_controller.rb | 2 +- app/models/channel.rb | 2 +- app/models/channel/driver/facebook.rb | 6 +-- app/models/channel/driver/twitter.rb | 22 +++++------ app/models/channel/email_parser.rb | 6 +-- .../channel/filter/bounce_follow_up_check.rb | 2 +- app/models/channel/filter/follow_up_check.rb | 10 ++--- app/models/channel/filter/identify_sender.rb | 8 ++-- .../concerns/checks_client_notification.rb | 8 ++-- app/models/job.rb | 4 +- .../communicate_telegram/background_job.rb | 2 +- app/models/observer/transaction.rb | 2 +- app/models/package.rb | 4 +- app/models/role.rb | 2 +- app/models/scheduler.rb | 4 +- app/models/setting.rb | 2 +- app/models/store/provider/file.rb | 4 +- app/models/ticket.rb | 4 +- app/models/transaction/notification.rb | 4 +- app/models/transaction/slack.rb | 6 +-- app/models/user_device.rb | 2 +- .../delayed_jobs_settings_reset.rb | 2 +- lib/core_ext/string.rb | 2 +- lib/email_helper/probe.rb | 16 ++++---- lib/facebook.rb | 26 ++++++------- lib/models.rb | 8 ++-- lib/search_index_backend.rb | 12 +++--- lib/sequencer.rb | 2 +- lib/sequencer/state.rb | 16 ++++---- .../common/model/associations/assign.rb | 2 +- .../common/model/associations/extract.rb | 6 +-- .../import/common/model/mixin/skip/action.rb | 8 ++-- .../import/common/model/skip/blank/base.rb | 2 +- .../model/skip/missing_mandatory/base.rb | 2 +- .../unit/import/common/model/update.rb | 2 +- .../exchange/folder_contacts/sub_sequence.rb | 4 +- lib/sessions.rb | 2 +- lib/sessions/client.rb | 2 +- lib/telegram.rb | 28 +++++++------- lib/tweet_base.rb | 38 +++++++++---------- 41 files changed, 148 insertions(+), 148 deletions(-) diff --git a/app/controllers/application_controller/authenticates.rb b/app/controllers/application_controller/authenticates.rb index c0b1ff341..fbf2a764d 100644 --- a/app/controllers/application_controller/authenticates.rb +++ b/app/controllers/application_controller/authenticates.rb @@ -47,7 +47,7 @@ module ApplicationController::Authenticates # already logged in, early exit if session.id && session[:user_id] - logger.debug 'session based auth check' + logger.debug { 'session based auth check' } user = User.lookup(id: session[:user_id]) return authentication_check_prerequesits(user, 'session', auth_param) if user end @@ -64,7 +64,7 @@ module ApplicationController::Authenticates # check http basic based authentication authenticate_with_http_basic do |username, password| request.session_options[:skip] = true # do not send a session cookie - logger.debug "http basic auth check '#{username}'" + logger.debug { "http basic auth check '#{username}'" } if Setting.get('api_password_access') == false raise Exceptions::NotAuthorized, 'API password access disabled!' end @@ -74,7 +74,7 @@ module ApplicationController::Authenticates # check http token based authentication authenticate_with_http_token do |token_string, _options| - logger.debug "http token auth check '#{token_string}'" + logger.debug { "http token auth check '#{token_string}'" } request.session_options[:skip] = true # do not send a session cookie if Setting.get('api_token_access') == false raise Exceptions::NotAuthorized, 'API token access disabled!' @@ -114,7 +114,7 @@ module ApplicationController::Authenticates token = Doorkeeper::OAuth::Token.from_bearer_authorization(request) if token request.session_options[:skip] = true # do not send a session cookie - logger.debug "oauth2 token auth check '#{token}'" + logger.debug { "oauth2 token auth check '#{token}'" } access_token = Doorkeeper::AccessToken.by_token(token) if !access_token @@ -153,7 +153,7 @@ module ApplicationController::Authenticates current_user_set(user, auth_type) user_device_log(user, auth_type) - logger.debug "#{auth_type} for '#{user.login}'" + logger.debug { "#{auth_type} for '#{user.login}'" } true end end diff --git a/app/controllers/long_polling_controller.rb b/app/controllers/long_polling_controller.rb index 5ac74de82..294617ec6 100644 --- a/app/controllers/long_polling_controller.rb +++ b/app/controllers/long_polling_controller.rb @@ -77,7 +77,7 @@ class LongPollingController < ApplicationController count = count - 1 queue = Sessions.queue(client_id) if queue && queue[0] - logger.debug "send #{queue.inspect} to #{client_id}" + logger.debug { "send #{queue.inspect} to #{client_id}" } render json: queue return end diff --git a/app/models/channel.rb b/app/models/channel.rb index faf8752f4..1503e0455 100644 --- a/app/models/channel.rb +++ b/app/models/channel.rb @@ -136,7 +136,7 @@ stream all accounts last_channels = [] loop do - logger.debug 'stream controll loop' + logger.debug { 'stream controll loop' } current_channels = [] channels = Channel.where('active = ? AND area LIKE ?', true, '%::Account') diff --git a/app/models/channel/driver/facebook.rb b/app/models/channel/driver/facebook.rb index 75809da88..af4f2e8ca 100644 --- a/app/models/channel/driver/facebook.rb +++ b/app/models/channel/driver/facebook.rb @@ -16,12 +16,12 @@ class Channel::Driver::Facebook @sync = options['sync'] @pages = options['pages'] - Rails.logger.debug 'facebook fetch started' + Rails.logger.debug { 'facebook fetch started' } fetch_feed disconnect - Rails.logger.debug 'facebook fetch completed' + Rails.logger.debug { 'facebook fetch completed' } notice = '' { result: 'ok', @@ -104,7 +104,7 @@ returns # ignore older messages if (@channel.created_at - 15.days) > Time.zone.parse(post['created_time']) || older_import >= older_import_max older_import += 1 - Rails.logger.debug "post to old: #{post['id']}/#{post['created_time']}" + Rails.logger.debug { "post to old: #{post['id']}/#{post['created_time']}" } next end diff --git a/app/models/channel/driver/twitter.rb b/app/models/channel/driver/twitter.rb index 406f9a9f8..33ecf4c1d 100644 --- a/app/models/channel/driver/twitter.rb +++ b/app/models/channel/driver/twitter.rb @@ -53,7 +53,7 @@ returns @sync = options[:sync] @channel = channel - Rails.logger.debug 'twitter fetch started' + Rails.logger.debug { 'twitter fetch started' } fetch_mentions fetch_search @@ -61,7 +61,7 @@ returns disconnect - Rails.logger.debug 'twitter fetch completed' + Rails.logger.debug { 'twitter fetch completed' } { result: 'ok', @@ -317,7 +317,7 @@ returns next if search[:term] == '#' next if search[:group_id].blank? result_type = search[:type] || 'mixed' - Rails.logger.debug " - searching for '#{search[:term]}'" + Rails.logger.debug { " - searching for '#{search[:term]}'" } older_import = 0 older_import_max = 20 @rest_client.client.search(search[:term], result_type: result_type).collect do |tweet| @@ -326,7 +326,7 @@ returns # ignore older messages if (@channel.created_at - 15.days) > tweet.created_at.dup.utc || older_import >= older_import_max older_import += 1 - Rails.logger.debug "tweet to old: #{tweet.id}/#{tweet.created_at}" + Rails.logger.debug { "tweet to old: #{tweet.id}/#{tweet.created_at}" } next end @@ -341,7 +341,7 @@ returns def fetch_mentions return if @sync[:mentions].blank? return if @sync[:mentions][:group_id].blank? - Rails.logger.debug ' - searching for mentions' + Rails.logger.debug { ' - searching for mentions' } older_import = 0 older_import_max = 20 @rest_client.client.mentions_timeline.each do |tweet| @@ -350,7 +350,7 @@ returns # ignore older messages if (@channel.created_at - 15.days) > tweet.created_at.dup.utc || older_import >= older_import_max older_import += 1 - Rails.logger.debug "tweet to old: #{tweet.id}/#{tweet.created_at}" + Rails.logger.debug { "tweet to old: #{tweet.id}/#{tweet.created_at}" } next end next if Ticket::Article.find_by(message_id: tweet.id) @@ -362,7 +362,7 @@ returns def fetch_direct_messages return if @sync[:direct_messages].blank? return if @sync[:direct_messages][:group_id].blank? - Rails.logger.debug ' - searching for direct_messages' + Rails.logger.debug { ' - searching for direct_messages' } older_import = 0 older_import_max = 20 @rest_client.client.direct_messages(full_text: 'true').each do |tweet| @@ -370,7 +370,7 @@ returns # ignore older messages if (@channel.created_at - 15.days) > tweet.created_at.dup.utc || older_import >= older_import_max older_import += 1 - Rails.logger.debug "tweet to old: #{tweet.id}/#{tweet.created_at}" + Rails.logger.debug { "tweet to old: #{tweet.id}/#{tweet.created_at}" } next end next if Ticket::Article.find_by(message_id: tweet.id) @@ -398,19 +398,19 @@ returns sleep 4 12.times do |loop_count| if Ticket::Article.find_by(message_id: tweet.id) - Rails.logger.debug "Own tweet already imported, skipping tweet #{tweet.id}" + Rails.logger.debug { "Own tweet already imported, skipping tweet #{tweet.id}" } return true end count = Delayed::Job.where('created_at < ?', event_time).count break if count.zero? sleep_time = 2 * count sleep_time = 5 if sleep_time > 5 - Rails.logger.debug "Delay importing own tweets - sleep #{sleep_time} (loop #{loop_count})" + Rails.logger.debug { "Delay importing own tweets - sleep #{sleep_time} (loop #{loop_count})" } sleep sleep_time end if Ticket::Article.find_by(message_id: tweet.id) - Rails.logger.debug "Own tweet already imported, skipping tweet #{tweet.id}" + Rails.logger.debug { "Own tweet already imported, skipping tweet #{tweet.id}" } return true end false diff --git a/app/models/channel/email_parser.rb b/app/models/channel/email_parser.rb index 0bc69704a..932eeec9d 100644 --- a/app/models/channel/email_parser.rb +++ b/app/models/channel/email_parser.rb @@ -349,7 +349,7 @@ class Channel::EmailParser filename = $1 end rescue - Rails.logger.debug 'Unable to get filename' + Rails.logger.debug { 'Unable to get filename' } end end @@ -532,7 +532,7 @@ returns filters[setting.name] = Kernel.const_get(Setting.get(setting.name)) end filters.each do |key, backend| - Rails.logger.debug "run postmaster pre filter #{key}: #{backend}" + Rails.logger.debug { "run postmaster pre filter #{key}: #{backend}" } begin backend.run(channel, mail) rescue => e @@ -684,7 +684,7 @@ returns filters[setting.name] = Kernel.const_get(Setting.get(setting.name)) end filters.each_value do |backend| - Rails.logger.debug "run postmaster post filter #{backend}" + Rails.logger.debug { "run postmaster post filter #{backend}" } begin backend.run(channel, mail, ticket, article, session_user) rescue => e diff --git a/app/models/channel/filter/bounce_follow_up_check.rb b/app/models/channel/filter/bounce_follow_up_check.rb index 973c72922..bb0891d58 100644 --- a/app/models/channel/filter/bounce_follow_up_check.rb +++ b/app/models/channel/filter/bounce_follow_up_check.rb @@ -20,7 +20,7 @@ module Channel::Filter::BounceFollowUpCheck article = Ticket::Article.where(message_id_md5: message_id_md5).order('created_at DESC, id DESC').limit(1).first next if !article - Rails.logger.debug "Follow up for '##{article.ticket.number}' in bounce email." + Rails.logger.debug { "Follow up for '##{article.ticket.number}' in bounce email." } mail[ 'x-zammad-ticket-id'.to_sym ] = article.ticket_id mail[ 'x-zammad-is-auto-response'.to_sym ] = true diff --git a/app/models/channel/filter/follow_up_check.rb b/app/models/channel/filter/follow_up_check.rb index 739f69df1..a48e21647 100644 --- a/app/models/channel/filter/follow_up_check.rb +++ b/app/models/channel/filter/follow_up_check.rb @@ -9,7 +9,7 @@ module Channel::Filter::FollowUpCheck # get ticket# from subject ticket = Ticket::Number.check(mail[:subject]) if ticket - Rails.logger.debug "Follow up for '##{ticket.number}' in subject." + Rails.logger.debug { "Follow up for '##{ticket.number}' in subject." } mail['x-zammad-ticket-id'.to_sym] = ticket.id return true end @@ -20,7 +20,7 @@ module Channel::Filter::FollowUpCheck if setting.include?('body') ticket = Ticket::Number.check(mail[:body]) if ticket - Rails.logger.debug "Follow up for '##{ticket.number}' in body." + Rails.logger.debug { "Follow up for '##{ticket.number}' in body." } mail['x-zammad-ticket-id'.to_sym] = ticket.id return true end @@ -32,7 +32,7 @@ module Channel::Filter::FollowUpCheck next if !attachment[:data] ticket = Ticket::Number.check(attachment[:data]) next if !ticket - Rails.logger.debug "Follow up for '##{ticket.number}' in attachment." + Rails.logger.debug { "Follow up for '##{ticket.number}' in attachment." } mail['x-zammad-ticket-id'.to_sym] = ticket.id return true end @@ -58,7 +58,7 @@ module Channel::Filter::FollowUpCheck message_id_md5 = Digest::MD5.hexdigest(message_id) article = Ticket::Article.where(message_id_md5: message_id_md5).order('created_at DESC, id DESC').limit(1).first next if !article - Rails.logger.debug "Follow up for '##{article.ticket.number}' in references." + Rails.logger.debug { "Follow up for '##{article.ticket.number}' in references." } mail['x-zammad-ticket-id'.to_sym] = article.ticket_id return true end @@ -97,7 +97,7 @@ module Channel::Filter::FollowUpCheck # if subject is different, it's no followup next if subject_to_check != article_first.subject - Rails.logger.debug "Follow up for '##{article.ticket.number}' in references with same subject as inital article." + Rails.logger.debug { "Follow up for '##{article.ticket.number}' in references with same subject as inital article." } mail['x-zammad-ticket-id'.to_sym] = article_first.ticket_id return true end diff --git a/app/models/channel/filter/identify_sender.rb b/app/models/channel/filter/identify_sender.rb index 35b4d3121..e1c0955f2 100644 --- a/app/models/channel/filter/identify_sender.rb +++ b/app/models/channel/filter/identify_sender.rb @@ -9,9 +9,9 @@ module Channel::Filter::IdentifySender if customer_user_id.present? customer_user = User.lookup(id: customer_user_id) if customer_user - Rails.logger.debug "Took customer form x-zammad-ticket-customer_id header '#{customer_user_id}'." + Rails.logger.debug { "Took customer form x-zammad-ticket-customer_id header '#{customer_user_id}'." } else - Rails.logger.debug "Invalid x-zammad-ticket-customer_id header '#{customer_user_id}', no such user - take user from 'from'-header." + Rails.logger.debug { "Invalid x-zammad-ticket-customer_id header '#{customer_user_id}', no such user - take user from 'from'-header." } end end @@ -70,9 +70,9 @@ module Channel::Filter::IdentifySender if session_user_id.present? session_user = User.lookup(id: session_user_id) if session_user - Rails.logger.debug "Took session form x-zammad-session-user-id header '#{session_user_id}'." + Rails.logger.debug { "Took session form x-zammad-session-user-id header '#{session_user_id}'." } else - Rails.logger.debug "Invalid x-zammad-session-user-id header '#{session_user_id}', no such user - take user from 'from'-header." + Rails.logger.debug { "Invalid x-zammad-session-user-id header '#{session_user_id}', no such user - take user from 'from'-header." } end end if !session_user diff --git a/app/models/concerns/checks_client_notification.rb b/app/models/concerns/checks_client_notification.rb index dea69363b..fc35db039 100644 --- a/app/models/concerns/checks_client_notification.rb +++ b/app/models/concerns/checks_client_notification.rb @@ -29,7 +29,7 @@ class OwnModel < ApplicationModel # return if we run import mode return if Setting.get('import_mode') - logger.debug "#{self.class.name}.find(#{id}) notify created " + created_at.to_s + logger.debug { "#{self.class.name}.find(#{id}) notify created #{created_at}" } class_name = self.class.name class_name.gsub!(/::/, '') PushMessages.send( @@ -61,7 +61,7 @@ class OwnModel < ApplicationModel # return if we run import mode return if Setting.get('import_mode') - logger.debug "#{self.class.name}.find(#{id}) notify UPDATED " + updated_at.to_s + logger.debug { "#{self.class.name}.find(#{id}) notify UPDATED #{updated_at}" } class_name = self.class.name class_name.gsub!(/::/, '') PushMessages.send( @@ -93,7 +93,7 @@ class OwnModel < ApplicationModel # return if we run import mode return if Setting.get('import_mode') - logger.debug "#{self.class.name}.find(#{id}) notify TOUCH " + updated_at.to_s + logger.debug { "#{self.class.name}.find(#{id}) notify TOUCH #{updated_at}" } class_name = self.class.name class_name.gsub!(/::/, '') PushMessages.send( @@ -124,7 +124,7 @@ class OwnModel < ApplicationModel # return if we run import mode return if Setting.get('import_mode') - logger.debug "#{self.class.name}.find(#{id}) notify DESTOY " + updated_at.to_s + logger.debug { "#{self.class.name}.find(#{id}) notify DESTOY #{updated_at}" } class_name = self.class.name class_name.gsub!(/::/, '') PushMessages.send( diff --git a/app/models/job.rb b/app/models/job.rb index 027a1de35..46ce7a6b4 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -47,7 +47,7 @@ job.run(true) =end def run(force = false, start_at = Time.zone.now) - logger.debug "Execute job #{inspect}" + logger.debug { "Execute job #{inspect}" } if !executable?(start_at) && force == false if next_run_at && next_run_at <= Time.zone.now @@ -72,7 +72,7 @@ job.run(true) # find tickets to change ticket_count, tickets = Ticket.selectors(condition, 2_000) - logger.debug "Job #{name} with #{ticket_count} tickets" + logger.debug { "Job #{name} with #{ticket_count} tickets" } self.processed = ticket_count || 0 self.running = true diff --git a/app/models/observer/ticket/article/communicate_telegram/background_job.rb b/app/models/observer/ticket/article/communicate_telegram/background_job.rb index 55d7dd0c0..1a0929472 100644 --- a/app/models/observer/ticket/article/communicate_telegram/background_job.rb +++ b/app/models/observer/ticket/article/communicate_telegram/background_job.rb @@ -44,7 +44,7 @@ class Observer::Ticket::Article::CommunicateTelegram::BackgroundJob return end - Rails.logger.debug "result info: #{result}" + Rails.logger.debug { "result info: #{result}" } # only private, group messages. channel messages do not have from key if result['from'] && result['chat'] diff --git a/app/models/observer/transaction.rb b/app/models/observer/transaction.rb index 3dfe47690..68c7cabf5 100644 --- a/app/models/observer/transaction.rb +++ b/app/models/observer/transaction.rb @@ -54,7 +54,7 @@ class Observer::Transaction < ActiveRecord::Observer end def self.execute_singel_backend(backend, item, params) - Rails.logger.debug "Execute singel backend #{backend}" + Rails.logger.debug { "Execute singel backend #{backend}" } begin UserInfo.current_user_id = nil integration = backend.new(item, params) diff --git a/app/models/package.rb b/app/models/package.rb index 361108685..57952f111 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -105,7 +105,7 @@ note: will not take down package migrations, use Package.unlink instead if package == false raise "Can't link package, '#{package_base_dir}' is no package source directory!" end - logger.debug package.inspect + logger.debug { package.inspect } package end @@ -424,7 +424,7 @@ execute all pending package migrations at once if File.exist?(location) content_fs = _read_file(file) if content_fs == data - logger.debug "NOTICE: file '#{location}' already exists, skip install" + logger.debug { "NOTICE: file '#{location}' already exists, skip install" } return true end backup_location = location + '.save' diff --git a/app/models/role.rb b/app/models/role.rb index 20525f034..49989c510 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -153,7 +153,7 @@ returns private def validate_permissions - Rails.logger.debug "self permission: #{self.permission_ids}" + Rails.logger.debug { "self permission: #{self.permission_ids}" } return true if !self.permission_ids permission_ids.each do |permission_id| permission = Permission.lookup(id: permission_id) diff --git a/app/models/scheduler.rb b/app/models/scheduler.rb index 98d4a3050..0c8b726c8 100644 --- a/app/models/scheduler.rb +++ b/app/models/scheduler.rb @@ -301,7 +301,7 @@ class Scheduler < ApplicationModel result = nil realtime = Benchmark.realtime do - logger.debug "*** worker thread, #{Delayed::Job.all.count} in queue" + logger.debug { "*** worker thread, #{Delayed::Job.all.count} in queue" } result = Delayed::Worker.new.work_off end @@ -309,7 +309,7 @@ class Scheduler < ApplicationModel if count.zero? sleep wait - logger.debug '*** worker thread loop' + logger.debug { '*** worker thread loop' } else format "*** #{count} jobs processed at %.4f j/s, %d failed ...\n", count / realtime, result.last end diff --git a/app/models/setting.rb b/app/models/setting.rb index 57479d4aa..c2ad31123 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -137,7 +137,7 @@ reload config settings def reset_change_id @@current[name] = state_current[:value] change_id = rand(999_999_999).to_s - logger.debug "Setting.reset_change_id: set new cache, #{change_id}" + logger.debug { "Setting.reset_change_id: set new cache, #{change_id}" } Cache.write('Setting::ChangeId', change_id, { expires_in: 24.hours }) @@lookup_at = nil # rubocop:disable Style/ClassVars true diff --git a/app/models/store/provider/file.rb b/app/models/store/provider/file.rb index 3d8b4f76d..d454612ff 100644 --- a/app/models/store/provider/file.rb +++ b/app/models/store/provider/file.rb @@ -8,7 +8,7 @@ class Store::Provider::File location = get_location(sha) permission = '600' if !File.exist?(location) - Rails.logger.debug "storge write '#{location}' (#{permission})" + Rails.logger.debug { "storge write '#{location}' (#{permission})" } file = File.new(location, 'wb') file.write(data) file.close @@ -27,7 +27,7 @@ class Store::Provider::File # read file from fs def self.get(sha) location = get_location(sha) - Rails.logger.debug "read from fs #{location}" + Rails.logger.debug { "read from fs #{location}" } if !File.exist?(location) raise "ERROR: No such file #{location}" end diff --git a/app/models/ticket.rb b/app/models/ticket.rb index 7007880cb..2d60d0cb4 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -805,7 +805,7 @@ perform changes on ticket =end def perform_changes(perform, perform_origin, item = nil, current_user_id = nil) - logger.debug "Perform #{perform_origin} #{perform.inspect} on Ticket.find(#{id})" + logger.debug { "Perform #{perform_origin} #{perform.inspect} on Ticket.find(#{id})" } # if the configuration contains the deletion of the ticket then # we skip all other ticket changes because they does not matter @@ -1065,7 +1065,7 @@ perform changes on ticket changed = true self[attribute] = value['value'] - logger.debug "set #{object_name}.#{attribute} = #{value['value'].inspect}" + logger.debug { "set #{object_name}.#{attribute} = #{value['value'].inspect}" } end return if !changed save diff --git a/app/models/transaction/notification.rb b/app/models/transaction/notification.rb index bbcad80d4..4d9bff765 100644 --- a/app/models/transaction/notification.rb +++ b/app/models/transaction/notification.rb @@ -153,7 +153,7 @@ class Transaction::Notification created_by_id: created_by_id, user_id: user.id, ) - Rails.logger.debug "sent ticket online notifiaction to agent (#{@item[:type]}/#{ticket.id}/#{user.email})" + Rails.logger.debug { "sent ticket online notifiaction to agent (#{@item[:type]}/#{ticket.id}/#{user.email})" } end # ignore email channel notificaiton and empty emails @@ -207,7 +207,7 @@ class Transaction::Notification main_object: ticket, attachments: attachments, ) - Rails.logger.debug "sent ticket email notifiaction to agent (#{@item[:type]}/#{ticket.id}/#{user.email})" + Rails.logger.debug { "sent ticket email notifiaction to agent (#{@item[:type]}/#{ticket.id}/#{user.email})" } end end diff --git a/app/models/transaction/slack.rb b/app/models/transaction/slack.rb index 3c49a61a3..ae5ec7a95 100644 --- a/app/models/transaction/slack.rb +++ b/app/models/transaction/slack.rb @@ -116,7 +116,7 @@ class Transaction::Slack if sent_value value = Cache.get(cache_key) if value == sent_value - Rails.logger.debug "did not send webhook, already sent (#{@item[:type]}/#{ticket.id}/#{local_config['webhook']})" + Rails.logger.debug { "did not send webhook, already sent (#{@item[:type]}/#{ticket.id}/#{local_config['webhook']})" } next end Cache.write( @@ -159,7 +159,7 @@ class Transaction::Slack logo_url = local_config['logo_url'] end - Rails.logger.debug "sent webhook (#{@item[:type]}/#{ticket.id}/#{local_config['webhook']})" + Rails.logger.debug { "sent webhook (#{@item[:type]}/#{ticket.id}/#{local_config['webhook']})" } notifier = Slack::Notifier.new( local_config['webhook'], @@ -188,7 +188,7 @@ class Transaction::Slack Rails.logger.error "Unable to post webhook: #{local_config['webhook']}: #{result.inspect}" next end - Rails.logger.debug "sent webhook (#{@item[:type]}/#{ticket.id}/#{local_config['webhook']})" + Rails.logger.debug { "sent webhook (#{@item[:type]}/#{ticket.id}/#{local_config['webhook']})" } end end diff --git a/app/models/user_device.rb b/app/models/user_device.rb index 4edb36d03..05ac72928 100644 --- a/app/models/user_device.rb +++ b/app/models/user_device.rb @@ -198,7 +198,7 @@ send user notification about new device or new location for device def notification_send(template) user = User.find(user_id) - Rails.logger.debug "Send notification (#{template}) to: #{user.email}" + Rails.logger.debug { "Send notification (#{template}) to: #{user.email}" } NotificationFactory::Mailer.notification( template: template, diff --git a/config/initializers/delayed_jobs_settings_reset.rb b/config/initializers/delayed_jobs_settings_reset.rb index d018098cc..3c3753480 100644 --- a/config/initializers/delayed_jobs_settings_reset.rb +++ b/config/initializers/delayed_jobs_settings_reset.rb @@ -5,7 +5,7 @@ class ResetSettingsPlugin < Delayed::Plugin callbacks do |lifecycle| lifecycle.before(:invoke_job) do |*_args| - Rails.logger.debug 'Resetting Settings before Job execution' + Rails.logger.debug { 'Resetting Settings before Job execution' } # reload all settings before starting a job # otherwise it might be that changed settings diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb index 89c914bf4..83c13626b 100644 --- a/lib/core_ext/string.rb +++ b/lib/core_ext/string.rb @@ -445,7 +445,7 @@ class String end rescue # regexp was not possible because of some string encoding issue, use next - Rails.logger.debug "Invalid string/charset combination with regexp #{regexp} in string" + Rails.logger.debug { "Invalid string/charset combination with regexp #{regexp} in string" } end end diff --git a/lib/email_helper/probe.rb b/lib/email_helper/probe.rb index 3e6a81d51..00d04372d 100644 --- a/lib/email_helper/probe.rb +++ b/lib/email_helper/probe.rb @@ -79,15 +79,15 @@ returns on fail end # probe inbound - Rails.logger.debug "INBOUND PROBE PROVIDER: #{settings[:inbound].inspect}" + Rails.logger.debug { "INBOUND PROBE PROVIDER: #{settings[:inbound].inspect}" } result_inbound = EmailHelper::Probe.inbound(settings[:inbound]) - Rails.logger.debug "INBOUND RESULT PROVIDER: #{result_inbound.inspect}" + Rails.logger.debug { "INBOUND RESULT PROVIDER: #{result_inbound.inspect}" } next if result_inbound[:result] != 'ok' # probe outbound - Rails.logger.debug "OUTBOUND PROBE PROVIDER: #{settings[:outbound].inspect}" + Rails.logger.debug { "OUTBOUND PROBE PROVIDER: #{settings[:outbound].inspect}" } result_outbound = EmailHelper::Probe.outbound(settings[:outbound], params[:email]) - Rails.logger.debug "OUTBOUND RESULT PROVIDER: #{result_outbound.inspect}" + Rails.logger.debug { "OUTBOUND RESULT PROVIDER: #{result_outbound.inspect}" } next if result_outbound[:result] != 'ok' return { @@ -116,9 +116,9 @@ returns on fail config[:options][:folder] = params[:folder] end - Rails.logger.debug "INBOUND PROBE GUESS: #{config.inspect}" + Rails.logger.debug { "INBOUND PROBE GUESS: #{config.inspect}" } result_inbound = EmailHelper::Probe.inbound(config) - Rails.logger.debug "INBOUND RESULT GUESS: #{result_inbound.inspect}" + Rails.logger.debug { "INBOUND RESULT GUESS: #{result_inbound.inspect}" } next if result_inbound[:result] != 'ok' @@ -144,9 +144,9 @@ returns on fail success = false outbound_map.each do |config| - Rails.logger.debug "OUTBOUND PROBE GUESS: #{config.inspect}" + Rails.logger.debug { "OUTBOUND PROBE GUESS: #{config.inspect}" } result_outbound = EmailHelper::Probe.outbound(config, params[:email]) - Rails.logger.debug "OUTBOUND RESULT GUESS: #{result_outbound.inspect}" + Rails.logger.debug { "OUTBOUND RESULT GUESS: #{result_outbound.inspect}" } next if result_outbound[:result] != 'ok' diff --git a/lib/facebook.rb b/lib/facebook.rb index 70af4a206..16bcca4e2 100644 --- a/lib/facebook.rb +++ b/lib/facebook.rb @@ -121,8 +121,8 @@ result end def to_user(item) - Rails.logger.debug 'Create user from item...' - Rails.logger.debug item.inspect + Rails.logger.debug { 'Create user from item...' } + Rails.logger.debug { item.inspect } # do item_user lookup item_user = user(item) @@ -196,9 +196,9 @@ result def to_ticket(post, group_id, channel, page) - Rails.logger.debug 'Create ticket from post...' - Rails.logger.debug post.inspect - Rails.logger.debug group_id.inspect + Rails.logger.debug { 'Create ticket from post...' } + Rails.logger.debug { post.inspect } + Rails.logger.debug { group_id.inspect } user = to_user(post) return if !user @@ -228,9 +228,9 @@ result def to_article(post, ticket, page) - Rails.logger.debug 'Create article from post...' - Rails.logger.debug post.inspect - Rails.logger.debug ticket.inspect + Rails.logger.debug { 'Create article from post...' } + Rails.logger.debug { post.inspect } + Rails.logger.debug { ticket.inspect } user = to_user(post) return if !user @@ -309,7 +309,7 @@ result end def to_group(post, group_id, channel, page) - Rails.logger.debug 'import post' + Rails.logger.debug { 'import post' } return if !post['message'] ticket = nil @@ -332,9 +332,9 @@ result if article[:type] != 'facebook feed comment' raise "Can't handle unknown facebook article type '#{article[:type]}'." end - Rails.logger.debug 'Create feed comment from article...' + Rails.logger.debug { 'Create feed comment from article...' } post = @client.put_comment(article[:in_reply_to], article[:body]) - Rails.logger.debug post.inspect + Rails.logger.debug { post.inspect } @client.get_object(post['id']) end @@ -371,8 +371,8 @@ result def nested_comments(comments, in_reply_to) - Rails.logger.debug 'Fetching nested comments...' - Rails.logger.debug comments.inspect + Rails.logger.debug { 'Fetching nested comments...' } + Rails.logger.debug { comments.inspect } result = [] return result if comments.blank? diff --git a/lib/models.rb b/lib/models.rb index 9aa1bd9d1..c6df06d8a 100644 --- a/lib/models.rb +++ b/lib/models.rb @@ -134,7 +134,7 @@ returns if !references[model_class.to_s][item] references[model_class.to_s][item] = 0 end - Rails.logger.debug "FOUND (by id) #{model_class}->#{item} #{count}!" + Rails.logger.debug { "FOUND (by id) #{model_class}->#{item} #{count}!" } references[model_class.to_s][item] += count end end @@ -154,7 +154,7 @@ returns if !references[model_class.to_s][col_name] references[model_class.to_s][col_name] = 0 end - Rails.logger.debug "FOUND (by ref without class) #{model_class}->#{col_name} #{count}!" + Rails.logger.debug { "FOUND (by ref without class) #{model_class}->#{col_name} #{count}!" } references[model_class.to_s][col_name] += count end @@ -166,7 +166,7 @@ returns if !references[model_class.to_s][col_name] references[model_class.to_s][col_name] = 0 end - Rails.logger.debug "FOUND (by ref with class) #{model_class}->#{col_name} #{count}!" + Rails.logger.debug { "FOUND (by ref with class) #{model_class}->#{col_name} #{count}!" } references[model_class.to_s][col_name] += count end end @@ -233,7 +233,7 @@ returns # collect items and attributes to update items_to_update = {} attributes.each_key do |attribute| - Rails.logger.debug "#{object_name}: #{model}.#{attribute}->#{object_id_to_merge}->#{object_id_primary}" + Rails.logger.debug { "#{object_name}: #{model}.#{attribute}->#{object_id_to_merge}->#{object_id_primary}" } model_object.where("#{attribute} = ?", object_id_to_merge).each do |item| if !items_to_update[item.id] items_to_update[item.id] = item diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb index 2b43e6ff1..92386651e 100644 --- a/lib/search_index_backend.rb +++ b/lib/search_index_backend.rb @@ -94,7 +94,7 @@ update processors ) end Rails.logger.info "# curl -X PUT \"#{url}\" \\" - Rails.logger.debug "-d '#{data.to_json}'" + Rails.logger.debug { "-d '#{data.to_json}'" } item.delete(:action) response = UserAgent.put( url, @@ -163,7 +163,7 @@ create/update/delete index end Rails.logger.info "# curl -X PUT \"#{url}\" \\" - Rails.logger.debug "-d '#{data[:data].to_json}'" + Rails.logger.debug { "-d '#{data[:data].to_json}'" } response = UserAgent.put( url, @@ -201,7 +201,7 @@ add new object to search index return if url.blank? Rails.logger.info "# curl -X POST \"#{url}\" \\" - Rails.logger.debug "-d '#{data.to_json}'" + Rails.logger.debug { "-d '#{data.to_json}'" } response = UserAgent.post( url, @@ -350,7 +350,7 @@ return search result data['query']['bool']['must'].push condition Rails.logger.info "# curl -X POST \"#{url}\" \\" - Rails.logger.debug " -d'#{data.to_json}'" + Rails.logger.debug { " -d'#{data.to_json}'" } response = UserAgent.get( url, @@ -448,7 +448,7 @@ get count of tickets and tickets which match on selector data = selector2query(selectors, current_user, aggs_interval, limit) Rails.logger.info "# curl -X POST \"#{url}\" \\" - Rails.logger.debug " -d'#{data.to_json}'" + Rails.logger.debug { " -d'#{data.to_json}'" } response = UserAgent.get( url, @@ -471,7 +471,7 @@ get count of tickets and tickets which match on selector response: response, ) end - Rails.logger.debug response.data.to_json + Rails.logger.debug { response.data.to_json } if aggs_interval.blank? || aggs_interval[:interval].blank? ticket_ids = [] diff --git a/lib/sequencer.rb b/lib/sequencer.rb index 139fd4a5d..3a8aab6c1 100644 --- a/lib/sequencer.rb +++ b/lib/sequencer.rb @@ -69,7 +69,7 @@ class Sequencer end state.to_h.tap do |result| - logger.debug("Returning Sequence '#{sequence.name}' result: #{result.inspect}") + logger.debug { "Returning Sequence '#{sequence.name}' result: #{result.inspect}" } end end diff --git a/lib/sequencer/state.rb b/lib/sequencer/state.rb index a3987a75d..460648e6c 100644 --- a/lib/sequencer/state.rb +++ b/lib/sequencer/state.rb @@ -88,7 +88,7 @@ class Sequencer # @return [Object, nil] def optional(attribute) return get(attribute) if @attributes.known?(attribute) - logger.debug("Access to unknown optional attribute '#{attribute}'.") + logger.debug { "Access to unknown optional attribute '#{attribute}'." } nil end @@ -184,13 +184,13 @@ class Sequencer end def set(attribute, value) - logger.debug("Setting '#{attribute}' value (#{value.class.name}): #{value.inspect}") + logger.debug { "Setting '#{attribute}' value (#{value.class.name}): #{value.inspect}" } @values[attribute] = value end def get(attribute) value = @values[attribute] - logger.debug("Getting '#{attribute}' value (#{value.class.name}): #{value.inspect}") + logger.debug { "Getting '#{attribute}' value (#{value.class.name}): #{value.inspect}" } value end @@ -209,19 +209,19 @@ class Sequencer def initialize_attributes(units) log_start_finish(:debug, 'Attributes lifespan initialization') do @attributes = Sequencer::Units::Attributes.new(units.declarations) - logger.debug("Attributes lifespan: #{@attributes.inspect}") + logger.debug { "Attributes lifespan: #{@attributes.inspect}" } end end def initialize_parameters(parameters) - logger.debug("Initializing Sequencer::State with initial parameters: #{parameters.inspect}") + logger.debug { "Initializing Sequencer::State with initial parameters: #{parameters.inspect}" } log_start_finish(:debug, 'Attribute value provisioning check and initialization') do @attributes.each do |identifier, attribute| if !attribute.will_be_used? - logger.debug("Attribute '#{identifier}' is provided by Unit(s) but never used.") + logger.debug { "Attribute '#{identifier}' is provided by Unit(s) but never used." } next end @@ -250,7 +250,7 @@ class Sequencer def initialize_expectations(expected_attributes) expected_attributes.each do |identifier| - logger.debug("Adding attribute '#{identifier}' to the list of expected result attributes.") + logger.debug { "Adding attribute '#{identifier}' to the list of expected result attributes." } @attributes[identifier].to = @result_index end end @@ -262,7 +262,7 @@ class Sequencer remove = !attribute.will_be_used? remove ||= attribute.to <= @index if remove && attribute.will_be_used? - logger.debug("Removing unneeded attribute '#{identifier}': #{@values[identifier].inspect}") + logger.debug { "Removing unneeded attribute '#{identifier}': #{@values[identifier].inspect}" } end remove end diff --git a/lib/sequencer/unit/import/common/model/associations/assign.rb b/lib/sequencer/unit/import/common/model/associations/assign.rb index 535ef457e..65c334517 100644 --- a/lib/sequencer/unit/import/common/model/associations/assign.rb +++ b/lib/sequencer/unit/import/common/model/associations/assign.rb @@ -29,7 +29,7 @@ class Sequencer private def changed? - logger.debug("Changed instance associations: #{changes.inspect}") + logger.debug { "Changed instance associations: #{changes.inspect}" } changes.present? end diff --git a/lib/sequencer/unit/import/common/model/associations/extract.rb b/lib/sequencer/unit/import/common/model/associations/extract.rb index 07ce60302..6dd8057ef 100644 --- a/lib/sequencer/unit/import/common/model/associations/extract.rb +++ b/lib/sequencer/unit/import/common/model/associations/extract.rb @@ -13,17 +13,17 @@ class Sequencer state.provide(:associations) do associations.collect do |association| - logger.debug("Checking association '#{association}'") + logger.debug { "Checking association '#{association}'" } next if !mapped.key?(association) # remove from the mapped values if it's an association value = mapped.delete(association) - logger.debug("Extracted association '#{association}' value '#{value.inspect}'") + logger.debug { "Extracted association '#{association}' value '#{value.inspect}'" } # skip if we don't track them next if tracked_associations.exclude?(association) - logger.debug("Using value of association '#{association}'") + logger.debug { "Using value of association '#{association}'" } [association, value] end.compact.to_h end diff --git a/lib/sequencer/unit/import/common/model/mixin/skip/action.rb b/lib/sequencer/unit/import/common/model/mixin/skip/action.rb index 795a0650b..0c7a32f17 100644 --- a/lib/sequencer/unit/import/common/model/mixin/skip/action.rb +++ b/lib/sequencer/unit/import/common/model/mixin/skip/action.rb @@ -22,9 +22,9 @@ class Sequencer end def skip_action?(action) - logger.debug("Checking if skip is necessary for action #{action.inspect}.") + logger.debug { "Checking if skip is necessary for action #{action.inspect}." } return false if action.blank? - logger.debug("Checking if skip is necessary for skip_actions #{skip_actions.inspect}.") + logger.debug { "Checking if skip is necessary for skip_actions #{skip_actions.inspect}." } return false if skip_actions.blank? return true if skip_actions.include?(action) return true if skip_actions.include?(:any) @@ -39,9 +39,9 @@ class Sequencer def process action = state.optional(:action) if self.class.skip_action?(action) - logger.debug("Skipping due to provided action #{action.inspect}.") + logger.debug { "Skipping due to provided action #{action.inspect}." } else - logger.debug("Nope. Won't skip action #{action.inspect}.") + logger.debug { "Nope. Won't skip action #{action.inspect}." } super end end diff --git a/lib/sequencer/unit/import/common/model/skip/blank/base.rb b/lib/sequencer/unit/import/common/model/skip/blank/base.rb index ffc9a769f..18f23e891 100644 --- a/lib/sequencer/unit/import/common/model/skip/blank/base.rb +++ b/lib/sequencer/unit/import/common/model/skip/blank/base.rb @@ -17,7 +17,7 @@ class Sequencer def process return if !skip? - logger.debug("Skipping. Blank #{attribute} found: #{attribute_value.inspect}") + logger.debug { "Skipping. Blank #{attribute} found: #{attribute_value.inspect}" } state.provide(:action, :skipped) end diff --git a/lib/sequencer/unit/import/common/model/skip/missing_mandatory/base.rb b/lib/sequencer/unit/import/common/model/skip/missing_mandatory/base.rb index d2f548c79..f4d9c3560 100644 --- a/lib/sequencer/unit/import/common/model/skip/missing_mandatory/base.rb +++ b/lib/sequencer/unit/import/common/model/skip/missing_mandatory/base.rb @@ -17,7 +17,7 @@ class Sequencer def process return if !skip? - logger.debug("Skipping. Missing mandatory attributes for #{attribute}: #{attribute_value.inspect}") + logger.debug { "Skipping. Missing mandatory attributes for #{attribute}: #{attribute_value.inspect}" } state.provide(:action, :skipped) end diff --git a/lib/sequencer/unit/import/common/model/update.rb b/lib/sequencer/unit/import/common/model/update.rb index d265b4c81..d9c3de17a 100644 --- a/lib/sequencer/unit/import/common/model/update.rb +++ b/lib/sequencer/unit/import/common/model/update.rb @@ -35,7 +35,7 @@ class Sequencer private def changed? - logger.debug("Changed instance attributes: #{changes.inspect}") + logger.debug { "Changed instance attributes: #{changes.inspect}" } changes.present? end diff --git a/lib/sequencer/unit/import/exchange/folder_contacts/sub_sequence.rb b/lib/sequencer/unit/import/exchange/folder_contacts/sub_sequence.rb index 2a6248e84..fb0eff3f6 100644 --- a/lib/sequencer/unit/import/exchange/folder_contacts/sub_sequence.rb +++ b/lib/sequencer/unit/import/exchange/folder_contacts/sub_sequence.rb @@ -39,7 +39,7 @@ class Sequencer } } - logger.debug "Fetching and processing #{per_page} items (page: #{page}, offset: #{offset}) from Exchange folder '#{display_path}' (total: #{total})" + logger.debug { "Fetching and processing #{per_page} items (page: #{page}, offset: #{offset}) from Exchange folder '#{display_path}' (total: #{total})" } folder.items(opts).each do |item| @@ -47,7 +47,7 @@ class Sequencer item = parameters[:resource] - logger.debug "Extracting attributes from Exchange item: #{item.get_all_properties!.inspect}" + logger.debug { "Extracting attributes from Exchange item: #{item.get_all_properties!.inspect}" } parameters.merge( resource: ::Import::Exchange::ItemAttributes.extract(item), diff --git a/lib/sessions.rb b/lib/sessions.rb index e5c87c492..ad1317d62 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -713,7 +713,7 @@ returns def self.log(level, message) if defined?(Rails) if level == 'debug' - Rails.logger.debug message + Rails.logger.debug { message } elsif level == 'notice' Rails.logger.notice message else diff --git a/lib/sessions/client.rb b/lib/sessions/client.rb index fe3ee0403..0529b346d 100644 --- a/lib/sessions/client.rb +++ b/lib/sessions/client.rb @@ -75,6 +75,6 @@ class Sessions::Client end def log(msg) - Rails.logger.debug "client(#{@node_id}.#{@client_id}) #{msg}" + Rails.logger.debug { "client(#{@node_id}.#{@client_id}) #{msg}" } end end diff --git a/lib/telegram.rb b/lib/telegram.rb index 017770980..53d0bd291 100644 --- a/lib/telegram.rb +++ b/lib/telegram.rb @@ -226,8 +226,8 @@ returns end def to_user(params) - Rails.logger.debug 'Create user from message...' - Rails.logger.debug params.inspect + Rails.logger.debug { 'Create user from message...' } + Rails.logger.debug { params.inspect } # do message_user lookup message_user = user(params) @@ -272,10 +272,10 @@ returns def to_ticket(params, user, group_id, channel) UserInfo.current_user_id = user.id - Rails.logger.debug 'Create ticket from message...' - Rails.logger.debug params.inspect - Rails.logger.debug user.inspect - Rails.logger.debug group_id.inspect + Rails.logger.debug { 'Create ticket from message...' } + Rails.logger.debug { params.inspect } + Rails.logger.debug { user.inspect } + Rails.logger.debug { group_id.inspect } # prepare title title = '-' @@ -341,13 +341,13 @@ returns def to_article(params, user, ticket, channel, article = nil) if article - Rails.logger.debug 'Update article from message...' + Rails.logger.debug { 'Update article from message...' } else - Rails.logger.debug 'Create article from message...' + Rails.logger.debug { 'Create article from message...' } end - Rails.logger.debug params.inspect - Rails.logger.debug user.inspect - Rails.logger.debug ticket.inspect + Rails.logger.debug { params.inspect } + Rails.logger.debug { user.inspect } + Rails.logger.debug { ticket.inspect } UserInfo.current_user_id = user.id @@ -529,7 +529,7 @@ returns def to_group(params, group_id, channel) # begin import - Rails.logger.debug 'import message' + Rails.logger.debug { 'import message' } # map channel_post params to message if params[:channel_post] @@ -660,12 +660,12 @@ returns def from_article(article) message = nil - Rails.logger.debug "Create telegram personal message from article to '#{article[:to]}'..." + Rails.logger.debug { "Create telegram personal message from article to '#{article[:to]}'..." } message = {} # TODO: create telegram message here - Rails.logger.debug message.inspect + Rails.logger.debug { message.inspect } message end diff --git a/lib/tweet_base.rb b/lib/tweet_base.rb index bf95d3ce4..e01a6ac67 100644 --- a/lib/tweet_base.rb +++ b/lib/tweet_base.rb @@ -10,12 +10,12 @@ class TweetBase def user(tweet) if tweet.class == Twitter::DirectMessage - Rails.logger.debug "Twitter sender for dm (#{tweet.id}): found" - Rails.logger.debug tweet.sender.inspect + Rails.logger.debug { "Twitter sender for dm (#{tweet.id}): found" } + Rails.logger.debug { tweet.sender.inspect } tweet.sender elsif tweet.class == Twitter::Tweet - Rails.logger.debug "Twitter sender for tweet (#{tweet.id}): found" - Rails.logger.debug tweet.user.inspect + Rails.logger.debug { "Twitter sender for tweet (#{tweet.id}): found" } + Rails.logger.debug { tweet.user.inspect } tweet.user else raise "Unknown tweet type '#{tweet.class}'" @@ -25,8 +25,8 @@ class TweetBase def to_user(tweet) - Rails.logger.debug 'Create user from tweet...' - Rails.logger.debug tweet.inspect + Rails.logger.debug { 'Create user from tweet...' } + Rails.logger.debug { tweet.inspect } # do tweet_user lookup tweet_user = user(tweet) @@ -102,10 +102,10 @@ class TweetBase def to_ticket(tweet, user, group_id, channel) UserInfo.current_user_id = user.id - Rails.logger.debug 'Create ticket from tweet...' - Rails.logger.debug tweet.inspect - Rails.logger.debug user.inspect - Rails.logger.debug group_id.inspect + Rails.logger.debug { 'Create ticket from tweet...' } + Rails.logger.debug { tweet.inspect } + Rails.logger.debug { user.inspect } + Rails.logger.debug { group_id.inspect } if tweet.class == Twitter::DirectMessage ticket = Ticket.find_by( @@ -143,10 +143,10 @@ class TweetBase def to_article(tweet, user, ticket, channel) - Rails.logger.debug 'Create article from tweet...' - Rails.logger.debug tweet.inspect - Rails.logger.debug user.inspect - Rails.logger.debug ticket.inspect + Rails.logger.debug { 'Create article from tweet...' } + Rails.logger.debug { tweet.inspect } + Rails.logger.debug { user.inspect } + Rails.logger.debug { ticket.inspect } # import tweet to = nil @@ -233,7 +233,7 @@ class TweetBase def to_group(tweet, group_id, channel) - Rails.logger.debug 'import tweet' + Rails.logger.debug { 'import tweet' } # use transaction if @connection_type == 'stream' @@ -289,7 +289,7 @@ class TweetBase tweet = nil if article[:type] == 'twitter direct-message' - Rails.logger.debug "Create twitter direct message from article to '#{article[:to]}'..." + Rails.logger.debug { "Create twitter direct message from article to '#{article[:to]}'..." } tweet = @client.create_direct_message( article[:to], @@ -298,7 +298,7 @@ class TweetBase ) elsif article[:type] == 'twitter status' - Rails.logger.debug 'Create tweet from article...' + Rails.logger.debug { 'Create tweet from article...' } tweet = @client.update( article[:body], @@ -310,7 +310,7 @@ class TweetBase raise "Can't handle unknown twitter article type '#{article[:type]}'." end - Rails.logger.debug tweet.inspect + Rails.logger.debug { tweet.inspect } tweet end @@ -392,7 +392,7 @@ class TweetBase next if !local_channel.options[:user] next if !local_channel.options[:user][:id] next if local_channel.options[:user][:id].to_s != tweet_user.id.to_s - Rails.logger.debug "Tweet is sent by local account with user id #{tweet_user.id} and tweet.id #{tweet.id}" + Rails.logger.debug { "Tweet is sent by local account with user id #{tweet_user.id} and tweet.id #{tweet.id}" } return true end false