Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to remove log messages #2029

Closed
msathieu opened this issue Jan 14, 2017 · 6 comments
Closed

Add an option to remove log messages #2029

msathieu opened this issue Jan 14, 2017 · 6 comments

Comments

@msathieu
Copy link
Contributor

msathieu commented Jan 14, 2017

I would like an option to turn this
[active_model_serializers] Rendered ActiveModel::Serializer::CollectionSerializer with ActiveModelSerializers::Adapter::JsonApi (136.7ms)
log message of.

@bf4
Copy link
Member

bf4 commented Jan 14, 2017

@msathieu Of course. We should reference that in docs/general/logging.md along with the log subscriber and active support notifications api.

It's unclear to me if you want to

  • set ActiveModelSerializers.logger = Logger.new(IO::NUL) or ActiveModelSerializers.logger = Logger.new(nil)
  • just unsubscribe ActiveSupport::Notifications.unsubscribe(ActiveModelSerializers::Logging::RENDER_EVENT)
    • and maybe ActiveSupport::LogSubscriber.log_subscribers.delete_if {|subscriber| subscriber.instance_of?(ActiveModelSerializers::Logging::LogSubscriber) }

though I haven't tried these myself.

@msathieu
Copy link
Contributor Author

I want to set ActiveModelSerializers.logger = Logger.new(nil)

@bf4
Copy link
Member

bf4 commented Jan 16, 2017

@msathieu did that resolve your issue?

@msathieu
Copy link
Contributor Author

msathieu commented Jan 17, 2017

@bf4 ActiveModelSerializers.logger = Logger.new(nil) doesn't works,
ActiveModelSerializers.logger = Logger.new(IO::NUL) raises an error,
but ActiveSupport::Notifications.unsubscribe(ActiveModelSerializers::Logging::RENDER_EVENT) works perfectly

@bf4
Copy link
Member

bf4 commented Jan 17, 2017

@msathieu Would you like to make a PR to improve the docs, especially based on how you went about looking for the info?

@msathieu
Copy link
Contributor Author

I will do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants