Module: RedisLogstash::ActionControllerExt
- Defined in:
- lib/redis_logstash/action_controller_ext.rb
Instance Method Summary collapse
- #get_original_flash ⇒ Object
- #get_original_params ⇒ Object
- #redis_logstash ⇒ Object
- #try_current_user_email ⇒ Object
Instance Method Details
#get_original_flash ⇒ Object
40 41 42 |
# File 'lib/redis_logstash/action_controller_ext.rb', line 40 def get_original_flash request.flash.clone end |
#get_original_params ⇒ Object
35 36 37 38 |
# File 'lib/redis_logstash/action_controller_ext.rb', line 35 def get_original_params path_params = request.path_parameters request.params.clone.except(*path_params.keys) end |
#redis_logstash ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/redis_logstash/action_controller_ext.rb', line 6 def redis_logstash original_params = get_original_params original_flash = get_original_flash yield begin custom_logs = { controller: params[:controller], action: params[:action], email: try_current_user_email, params: original_params, flash: original_flash, response_code: response.status, response_message: response. } RedisLogstash::Logger.write(custom_logs) rescue Rails.logger.info "[CUSTOM LOGS NOT SAVED]: #{custom_logs.to_json}" end end |
#try_current_user_email ⇒ Object
31 32 33 |
# File 'lib/redis_logstash/action_controller_ext.rb', line 31 def try_current_user_email current_user.email rescue '' end |