Skip to content

Commit

Permalink
change log level to debug for messages create
Browse files Browse the repository at this point in the history
  • Loading branch information
mortbauer committed Mar 9, 2024
1 parent 010778d commit 9bfd57f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery
before_action :authenticate, :set_user_last_activity, :store_controller, :items_per_page
after_action :remove_controller
around_action :set_time_zone, :set_currency
around_action :set_time_zone, :set_currency, :set_log_level

# needed for linking to attachments on locals storage

Check failure on line 14 in app/controllers/application_controller.rb

View workflow job for this annotation

GitHub Actions / test

Layout/TrailingWhitespace: Trailing whitespace detected.
before_action do
Expand Down Expand Up @@ -98,4 +98,14 @@ def set_currency
ensure
::I18n.backend.store_translations(::I18n.locale, number: { currency: { format: { unit: old_currency } } })
end

def set_log_level
old_log_levl = Rails.logger.level
if params[:controller] == 'messages' and params[:action] == 'create'

Check failure on line 104 in app/controllers/application_controller.rb

View workflow job for this annotation

GitHub Actions / test

Style/IfUnlessModifier: Favor modifier `if` usage when having a single-line body. Another good alternative is the usage of control flow `&&`/`||`.

Check failure on line 104 in app/controllers/application_controller.rb

View workflow job for this annotation

GitHub Actions / test

Style/AndOr: Use `&&` instead of `and`.
Rails.logger.level = 0
end
yield
ensure
Rails.logger.level = old_log_levl

Check failure on line 109 in app/controllers/application_controller.rb

View workflow job for this annotation

GitHub Actions / test

Layout/IndentationWidth: Use 2 (not 4) spaces for indentation.
end
end

0 comments on commit 9bfd57f

Please sign in to comment.