123456789_123456789_123456789_123456789_123456789_

Class: ActiveStorage::LogSubscriber

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActiveSupport::LogSubscriber
Defined in: activestorage/lib/active_storage/log_subscriber.rb

Constant Summary

::ActiveSupport::LogSubscriber - Inherited

BLACK, BLUE, BOLD, CLEAR, CYAN, GREEN, MAGENTA, RED, WHITE, YELLOW

Class Attribute Summary

Class Method Summary

::ActiveSupport::LogSubscriber - Inherited

.flush_all!

Flush all log_subscribers’ logger.

.log_subscribers

::ActiveSupport::Subscriber - Inherited

.attach_to

Attach the subscriber to a namespace.

.method_added

Adds event subscribers for all new methods added to the class.

.new, .subscribers, .add_event_subscriber

Instance Attribute Summary

Instance Method Summary

Constructor Details

This class inherits a constructor from ActiveSupport::Subscriber

Instance Method Details

#logger

[ GitHub ]

  
# File 'activestorage/lib/active_storage/log_subscriber.rb', line 35

def logger
  ActiveStorage.logger
end

#service_delete(event)

[ GitHub ]

  
# File 'activestorage/lib/active_storage/log_subscriber.rb', line 19

def service_delete(event)
  info event, color("Deleted file from key: #{key_in(event)}", RED)
end

#service_delete_prefixed(event)

[ GitHub ]

  
# File 'activestorage/lib/active_storage/log_subscriber.rb', line 23

def service_delete_prefixed(event)
  info event, color("Deleted files by key prefix: #{event.payload[:prefix]}", RED)
end

#service_download(event) Also known as: #service_streaming_download

[ GitHub ]

  
# File 'activestorage/lib/active_storage/log_subscriber.rb', line 13

def service_download(event)
  info event, color("Downloaded file from key: #{key_in(event)}", BLUE)
end

#service_exist(event)

[ GitHub ]

  
# File 'activestorage/lib/active_storage/log_subscriber.rb', line 27

def service_exist(event)
  debug event, color("Checked if file exists at key: #{key_in(event)} (#{event.payload[:exist] ? "yes" : "no"})", BLUE)
end

#service_streaming_download(event)

Alias for #service_download.

[ GitHub ]

  
# File 'activestorage/lib/active_storage/log_subscriber.rb', line 17

alias_method :service_streaming_download, :service_download

#service_upload(event)

[ GitHub ]

  
# File 'activestorage/lib/active_storage/log_subscriber.rb', line 7

def service_upload(event)
  message = "Uploaded file to key: #{key_in(event)}"
  message += " (checksum: #{event.payload[:checksum]})" if event.payload[:checksum]
  info event, color(message, GREEN)
end

#service_url(event)

[ GitHub ]

  
# File 'activestorage/lib/active_storage/log_subscriber.rb', line 31

def service_url(event)
  debug event, color("Generated URL for file at key: #{key_in(event)} (#{event.payload[:url]})", BLUE)
end