Add preview to ActiveStorage::LogSubscriber
a `preview` event is being instrumented in `ActiveStorage::Previewer`. However it is not added inside ActiveStorage's `LogSubscriber` class.
This commit is contained in:
parent
be0b5c65a1
commit
0b8496fa7e
@ -1,3 +1,14 @@
|
||||
* Add missing preview event to `ActiveStorage::LogSubscriber`
|
||||
|
||||
A `preview` event is being instrumented in `ActiveStorage::Previewer`.
|
||||
However it was not added inside ActiveStorage's LogSubscriber class.
|
||||
|
||||
This will allow to have logs for when a preview happens
|
||||
in the same fashion as all other ActiveStorage events such as
|
||||
`upload` and `download` inside `Rails.logger`.
|
||||
|
||||
*Chedli Bourguiba*
|
||||
|
||||
* Fix retrieving rotation value from FFmpeg on version 5.0+.
|
||||
|
||||
In FFmpeg version 5.0+ the rotation value has been removed from tags.
|
||||
|
@ -18,6 +18,11 @@ def service_download(event)
|
||||
|
||||
alias_method :service_streaming_download, :service_download
|
||||
|
||||
def preview(event)
|
||||
info event, color("Previewed file from key: #{key_in(event)}", BLUE)
|
||||
end
|
||||
subscribe_log_level :preview, :info
|
||||
|
||||
def service_delete(event)
|
||||
info event, color("Deleted file from key: #{key_in(event)}", RED)
|
||||
end
|
||||
|
@ -65,7 +65,12 @@ def open_tempfile
|
||||
end
|
||||
|
||||
def instrument(operation, payload = {}, &block)
|
||||
ActiveSupport::Notifications.instrument "#{operation}.active_storage", payload, &block
|
||||
ActiveSupport::Notifications.instrument "#{operation}.active_storage", payload.merge(service: service_name), &block
|
||||
end
|
||||
|
||||
def service_name
|
||||
# ActiveStorage::Service::DiskService => Disk
|
||||
blob.service.class.to_s.split("::").third.remove("Service")
|
||||
end
|
||||
|
||||
def capture(*argv, to:)
|
||||
|
Loading…
Reference in New Issue
Block a user