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

Need A Better Check for Rails.logger #406

Closed
benhutton opened this issue Jan 28, 2022 · 3 comments
Closed

Need A Better Check for Rails.logger #406

benhutton opened this issue Jan 28, 2022 · 3 comments

Comments

@benhutton
Copy link

benhutton commented Jan 28, 2022

This is not a safe way to check if an app is a rails app: https://github.com/plaid/plaid-ruby/blob/master/lib/plaid/configuration.rb#L161

We are NOT a rails app, yet Rails is defined because we use one of Rails' spun-off gems: https://github.com/rails/rails-html-sanitizer/blob/master/lib/rails-html-sanitizer.rb#L6

We are not actually loading the rails gem that would define Rails.logger. In our system, Rails is just a module.

Ideally, the aforementioned line would get replaced as follows:

@logger = (defined?(Rails) && Rails.respond_to?(:logger)) ? Rails.logger : Logger.new(STDOUT)
@cgfarmer4
Copy link
Contributor

Hey @benhutton - we're working on a fix here and will update with the next minor version. Thanks for calling this out!

@vorpus
Copy link
Contributor

vorpus commented Feb 11, 2022

Hi @benhutton - Could you see if version 14.12.1 solves your rails checking problem? Thanks!

@benhutton
Copy link
Author

@vorpus yes it does. Thank you!

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

No branches or pull requests

3 participants