Class: ActiveModelSerializers::Logging::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/active_model_serializers/logging.rb

Instance Method Summary collapse

Instance Method Details

#loggerObject



117
118
119
# File 'lib/active_model_serializers/logging.rb', line 117

def logger
  ActiveModelSerializers.logger
end

#render(event) ⇒ Object



108
109
110
111
112
113
114
115
# File 'lib/active_model_serializers/logging.rb', line 108

def render(event)
  info do
    serializer = event.payload[:serializer]
    adapter = event.payload[:adapter]
    duration = event.duration.round(2)
    "Rendered #{serializer.name} with #{adapter.class} (#{duration}ms)"
  end
end