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



115
116
117
# File 'lib/active_model_serializers/logging.rb', line 115

def logger
  ActiveModelSerializers.logger
end

#render(event) ⇒ Object



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

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