feat: fix logging levels (#4314)
https://ruby-doc.org/stdlib-2.7.0/libdoc/logger/rdoc/Logger.html Fixes https://github.com/chatwoot/chatwoot/issues/4313
This commit is contained in:
@@ -70,7 +70,7 @@ class ContactBuilder
|
||||
update_contact_avatar(contact)
|
||||
contact_inbox
|
||||
rescue StandardError => e
|
||||
Rails.logger.info e
|
||||
Rails.logger.error e
|
||||
raise e
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ class Messages::Facebook::MessageBuilder < Messages::Messenger::MessageBuilder
|
||||
end
|
||||
ensure_contact_avatar
|
||||
rescue Koala::Facebook::AuthenticationError
|
||||
Rails.logger.info "Facebook Authorization expired for Inbox #{@inbox.id}"
|
||||
Rails.logger.error "Facebook Authorization expired for Inbox #{@inbox.id}"
|
||||
rescue StandardError => e
|
||||
Sentry.capture_exception(e)
|
||||
true
|
||||
|
||||
@@ -77,7 +77,7 @@ class Api::V1::Accounts::CallbacksController < Api::V1::Accounts::BaseController
|
||||
koala = Koala::Facebook::OAuth.new(GlobalConfigService.load('FB_APP_ID', ''), GlobalConfigService.load('FB_APP_SECRET', ''))
|
||||
koala.exchange_access_token_info(omniauth_token)['access_token']
|
||||
rescue StandardError => e
|
||||
Rails.logger.info e
|
||||
Rails.logger.error e
|
||||
end
|
||||
|
||||
def mark_already_existing_facebook_pages(data)
|
||||
|
||||
@@ -14,7 +14,7 @@ class Twitter::CallbacksController < Twitter::BaseController
|
||||
redirect_to app_twitter_inbox_agents_url(account_id: account.id, inbox_id: inbox.id)
|
||||
end
|
||||
rescue StandardError => e
|
||||
Rails.logger.info e
|
||||
Rails.logger.error e
|
||||
redirect_to twitter_app_redirect_url
|
||||
end
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class Webhooks::InstagramController < ApplicationController
|
||||
::Webhooks::InstagramEventsJob.perform_later(params.to_unsafe_hash[:entry])
|
||||
render json: :ok
|
||||
else
|
||||
Rails.logger.info("Message is not received from the instagram webhook event: #{params['object']}")
|
||||
Rails.logger.warn("Message is not received from the instagram webhook event: #{params['object']}")
|
||||
head :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,6 @@ class ContactAvatarJob < ApplicationJob
|
||||
)
|
||||
contact.avatar.attach(io: avatar_file, filename: avatar_file.original_filename, content_type: avatar_file.content_type)
|
||||
rescue Down::Error => e
|
||||
Rails.logger.info "Exception: invalid avatar url #{avatar_url} : #{e.message}"
|
||||
Rails.logger.error "Exception: invalid avatar url #{avatar_url} : #{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class ContactIpLookupJob < ApplicationJob
|
||||
|
||||
update_contact_location_from_ip(contact)
|
||||
rescue Errno::ETIMEDOUT => e
|
||||
Rails.logger.info "Exception: ip resolution failed : #{e.message}"
|
||||
Rails.logger.warn "Exception: ip resolution failed : #{e.message}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -25,8 +25,8 @@ class ApplicationMailer < ActionMailer::Base
|
||||
private
|
||||
|
||||
def handle_smtp_exceptions(message)
|
||||
Rails.logger.info 'Failed to send Email'
|
||||
Rails.logger.info "Exception: #{message}"
|
||||
Rails.logger.warn 'Failed to send Email'
|
||||
Rails.logger.error "Exception: #{message}"
|
||||
end
|
||||
|
||||
def send_mail_with_liquid(*args)
|
||||
|
||||
@@ -45,7 +45,7 @@ class Channel::FacebookPage < ApplicationRecord
|
||||
source_id: instagram_id
|
||||
)
|
||||
rescue StandardError => e
|
||||
Rails.logger.info e
|
||||
Rails.logger.error e
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class Channel::TwitterProfile < ApplicationRecord
|
||||
source_id: profile_id
|
||||
)
|
||||
rescue StandardError => e
|
||||
Rails.logger.info e
|
||||
Rails.logger.error e
|
||||
end
|
||||
end
|
||||
|
||||
@@ -62,6 +62,6 @@ class Channel::TwitterProfile < ApplicationRecord
|
||||
unsubscribe_response = twitter_client.remove_subscription(user_id: profile_id)
|
||||
Rails.logger.info "TWITTER_UNSUBSCRIBE: #{unsubscribe_response.body}"
|
||||
rescue StandardError => e
|
||||
Rails.logger.info e
|
||||
Rails.logger.error e
|
||||
end
|
||||
end
|
||||
|
||||
@@ -86,7 +86,7 @@ class Channel::WebWidget < ApplicationRecord
|
||||
)
|
||||
contact_inbox
|
||||
rescue StandardError => e
|
||||
Rails.logger.info e
|
||||
Rails.logger.error e
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -62,7 +62,7 @@ class Instagram::SendOnInstagramService < Base::SendOnChannelService
|
||||
query: query
|
||||
)
|
||||
|
||||
Rails.logger.info("Instagram response: #{response['error']} : #{message_content}") if response['error']
|
||||
Rails.logger.error("Instagram response: #{response['error']} : #{message_content}") if response['error']
|
||||
message.update!(source_id: response['message_id']) if response['message_id'].present?
|
||||
|
||||
response
|
||||
|
||||
@@ -66,7 +66,7 @@ class Notification::PushNotificationService
|
||||
rescue Webpush::ExpiredSubscription
|
||||
subscription.destroy!
|
||||
rescue Errno::ECONNRESET, Net::OpenTimeout, Net::ReadTimeout => e
|
||||
Rails.logger.info "Webpush operation error: #{e.message}"
|
||||
Rails.logger.error "Webpush operation error: #{e.message}"
|
||||
end
|
||||
|
||||
def send_fcm_push(subscription)
|
||||
|
||||
@@ -5,14 +5,14 @@ class Twilio::WebhookSetupService
|
||||
|
||||
def perform
|
||||
if phone_numbers.empty?
|
||||
Rails.logger.info "TWILIO_PHONE_NUMBER_NOT_FOUND: #{channel.phone_number}"
|
||||
Rails.logger.warn "TWILIO_PHONE_NUMBER_NOT_FOUND: #{channel.phone_number}"
|
||||
else
|
||||
twilio_client
|
||||
.incoming_phone_numbers(phonenumber_sid)
|
||||
.update(sms_method: 'POST', sms_url: twilio_callback_index_url)
|
||||
end
|
||||
rescue Twilio::REST::TwilioError => e
|
||||
Rails.logger.info "TWILIO_FAILURE: #{e.message}"
|
||||
Rails.logger.error "TWILIO_FAILURE: #{e.message}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -58,7 +58,7 @@ class Twitter::SendOnTwitterService < Base::SendOnChannelService
|
||||
tweet_data = response.body
|
||||
message.update!(source_id: tweet_data['id_str'])
|
||||
else
|
||||
Rails.logger.info "TWITTER_TWEET_REPLY_ERROR #{response.body}"
|
||||
Rails.logger.error "TWITTER_TWEET_REPLY_ERROR #{response.body}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user