class Shrine::Plugins::Instrumentation::LogSubscriber

  1. lib/shrine/plugins/instrumentation.rb
Superclass: Object

Logs received events.

Methods

Public Class

  1. call

Public Instance

  1. on_delete
  2. on_download
  3. on_exists
  4. on_metadata
  5. on_open
  6. on_upload

Public Class methods

call(event)

Entry point for logging.

[show source]
    # File lib/shrine/plugins/instrumentation.rb
242 def self.call(event)
243   new.public_send(:"on_#{event.name}", event)
244 end

Public Instance methods

on_delete(event)
[show source]
    # File lib/shrine/plugins/instrumentation.rb
282 def on_delete(event)
283   log "Delete (#{event.duration}ms) – #{format(
284     storage:  event[:storage],
285     location: event[:location],
286     uploader: event[:uploader],
287   )}"
288 end
on_download(event)
[show source]
    # File lib/shrine/plugins/instrumentation.rb
256 def on_download(event)
257   log "Download (#{event.duration}ms) – #{format(
258     storage:          event[:storage],
259     location:         event[:location],
260     download_options: event[:download_options],
261     uploader:         event[:uploader],
262   )}"
263 end
on_exists(event)
[show source]
    # File lib/shrine/plugins/instrumentation.rb
274 def on_exists(event)
275   log "Exists (#{event.duration}ms) – #{format(
276     storage:  event[:storage],
277     location: event[:location],
278     uploader: event[:uploader],
279   )}"
280 end
on_metadata(event)
[show source]
    # File lib/shrine/plugins/instrumentation.rb
290 def on_metadata(event)
291   log "Metadata (#{event.duration}ms) – #{format(
292     storage:  event[:storage],
293     io:       event[:io].class,
294     uploader: event[:uploader],
295   )}"
296 end
on_open(event)
[show source]
    # File lib/shrine/plugins/instrumentation.rb
265 def on_open(event)
266   log "Open (#{event.duration}ms) – #{format(
267     storage:          event[:storage],
268     location:         event[:location],
269     download_options: event[:download_options],
270     uploader:         event[:uploader],
271   )}"
272 end
on_upload(event)
[show source]
    # File lib/shrine/plugins/instrumentation.rb
246 def on_upload(event)
247   log "Upload (#{event.duration}ms) – #{format(
248     storage:        event[:storage],
249     location:       event[:location],
250     io:             event[:io].class,
251     upload_options: event[:upload_options],
252     uploader:       event[:uploader],
253   )}"
254 end