diff --git a/Gemfile b/Gemfile index bb31ea63a..06d4da43c 100644 --- a/Gemfile +++ b/Gemfile @@ -186,4 +186,4 @@ group :development, :test do gem 'spring-watcher-listen' end -gem "lograge", "~> 0.12.0" +gem 'lograge', '~> 0.12.0' diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8bab35591..63416e0ca 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -27,14 +27,13 @@ class ApplicationController < ActionController::Base def append_info_to_payload(payload) super - case - when payload[:status] == 200 - payload[:level] = "INFO" - when payload[:status] == 302 - payload[:level] = "WARN" - else - payload[:level] = "ERROR" - end + payload[:level] = case payload[:status] + when 200 + 'INFO' + when 302 + 'WARN' + else + 'ERROR' + end end - end diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb index bf0a44922..94b03595a 100644 --- a/config/initializers/lograge.rb +++ b/config/initializers/lograge.rb @@ -1,8 +1,7 @@ Rails.application.configure do - config.lograge.enabled = true config.lograge.keep_original_rails_log = true - config.lograge.formatter = Lograge::Formatters::Json.new + config.lograge.formatter = Lograge::Formatters::Json.new config.colorize_logging = false config.lograge.custom_payload do |controller| { @@ -12,17 +11,13 @@ Rails.application.configure do end config.lograge.custom_options = lambda do |event| - { - :level => event.payload[:level] + { + level: event.payload[:level] } end config.lograge.ignore_custom = lambda do |event| - #ignore update_presence events in log - if event.payload[:channel_class] == "RoomChannel" - return true - end + # ignore update_presence events in log + return true if event.payload[:channel_class] == 'RoomChannel' end - end -