Class: Lograge::RequestLogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- Lograge::RequestLogSubscriber
- Defined in:
- lib/lograge/log_subscriber.rb
Instance Method Summary collapse
- #logger ⇒ Object
- #process_action(event) ⇒ Object
- #redirect_to(event) ⇒ Object
- #unpermitted_parameters(event) ⇒ Object
Instance Method Details
#logger ⇒ Object
28 29 30 |
# File 'lib/lograge/log_subscriber.rb', line 28 def logger Lograge.logger.presence || super end |
#process_action(event) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/lograge/log_subscriber.rb', line 9 def process_action(event) return if Lograge.ignore?(event) payload = event.payload data = extract_request(event, payload) data = before_format(data, payload) = Lograge.formatter.call(data) logger.send(Lograge.log_level, ) end |
#redirect_to(event) ⇒ Object
19 20 21 |
# File 'lib/lograge/log_subscriber.rb', line 19 def redirect_to(event) RequestStore.store[:lograge_location] = event.payload[:location] end |
#unpermitted_parameters(event) ⇒ Object
23 24 25 26 |
# File 'lib/lograge/log_subscriber.rb', line 23 def unpermitted_parameters(event) RequestStore.store[:lograge_unpermitted_params] ||= [] RequestStore.store[:lograge_unpermitted_params].concat(event.payload[:keys]) end |