jsonapi-rb / jsonapi-rails

Rails gem for fast jsonapi-compliant APIs.
http://jsonapi-rb.org
MIT License
318 stars 62 forks source link

Remove log message #116

Closed wee007 closed 4 years ago

wee007 commented 4 years ago

Is there a way to remove this log message apart from a monkey patch?

INFO -- : Completed JSON API rendering

I've tried unsubscribing the subscriber and detaching the namespace but to no avail.

raldred commented 4 years ago

Agreed, they're really noisy and should be moved to debug

raldred commented 4 years ago

@wee007 Only way I could find to do this was to unsubscribe the instrumentation in an initializer

# config/initializers/jsonapi-rails.rb
ActiveSupport::Notifications.unsubscribe('parse.jsonapi-rails')
ActiveSupport::Notifications.unsubscribe('render.jsonapi-rails')
wee007 commented 4 years ago

Thanks heaps @raldred ! That worked.

ndbroadbent commented 2 years ago

I just ran into this issue. I fixed it by adding this to spec/rails_helper.rb:

ActiveSupport.on_load(:action_controller) do
  ActiveSupport::Notifications.unsubscribe('parse.jsonapi-rails')
  ActiveSupport::Notifications.unsubscribe('render.jsonapi-rails')
end