Class: ActiveStorage::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- ActiveStorage::LogSubscriber
- Defined in:
- lib/active_storage/log_subscriber.rb
Instance Method Summary collapse
- #logger ⇒ Object
- #service_delete(event) ⇒ Object
- #service_download(event) ⇒ Object
- #service_exist(event) ⇒ Object
- #service_upload(event) ⇒ Object
- #service_url(event) ⇒ Object
Instance Method Details
#logger ⇒ Object
26 27 28 |
# File 'lib/active_storage/log_subscriber.rb', line 26 def logger ActiveStorage::Service.logger end |
#service_delete(event) ⇒ Object
14 15 16 |
# File 'lib/active_storage/log_subscriber.rb', line 14 def service_delete(event) info event, color("Deleted file from key: #{key_in(event)}", RED) end |
#service_download(event) ⇒ Object
10 11 12 |
# File 'lib/active_storage/log_subscriber.rb', line 10 def service_download(event) info event, color("Downloaded file from key: #{key_in(event)}", BLUE) end |
#service_exist(event) ⇒ Object
18 19 20 |
# File 'lib/active_storage/log_subscriber.rb', line 18 def service_exist(event) debug event, color("Checked if file exist at key: #{key_in(event)} (#{event.payload[:exist] ? "yes" : "no"})", BLUE) end |
#service_upload(event) ⇒ Object
4 5 6 7 8 |
# File 'lib/active_storage/log_subscriber.rb', line 4 def service_upload(event) = "Uploaded file to key: #{key_in(event)}" << " (checksum: #{event.payload[:checksum]})" if event.payload[:checksum] info event, color(, GREEN) end |
#service_url(event) ⇒ Object
22 23 24 |
# File 'lib/active_storage/log_subscriber.rb', line 22 def service_url(event) debug event, color("Generated URL for file at key: #{key_in(event)} (#{event.payload[:url]})", BLUE) end |