Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'active_support/log_subscriber'
- module ActiveStorage
- class LogSubscriber < ActiveSupport::LogSubscriber
- def service_upload(event)
- message = event.payload[:something]
- info event, color(message, GREEN)
- end
- end
- end
- ActiveStorage::LogSubscriber.attach_to :active_storage
- module ActiveStorage
- class Service
- def upload
- instrument :upload, key: key, checksum: checksum
- end
- private
- def instrument(operation, payload = {}, &block)
- ActiveSupport::Notifications.instrument "service_#{operation}.active_storage", payload
- end
- end
- end
Add Comment
Please, Sign In to add comment