Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5146

Investigate using ActiveSupport deprecation framework for deprecation warnings

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      In the linked tickets, deprecation warnings were added for various situations. ActiveSupport has a system for handling deprecations which seems to be decently described in https://everydayrails.com/2021/07/31/rails-custom-deprecation-warnings.html. It would probably be beneficial for Mongoid to use it instead of simply calling Logger#warn.

      One caveat here is the log destination - ideally Mongoid's logger and AS (via Rails) logger are the same, hence the destination would be the same. If not this would need to be thought out.

      shields@tablecheck.com remarked in https://github.com/mongodb/mongoid/pull/5040:


      By default ActiveSupport::Deprecation.warn is going to use Rails logger with a fallback to $stderr. However, it looks that there is a way to add a Mongoid-specific behavior that would use Mongoid's logger.

      The rest of the codebase should be audited for deprecation warnings also as part of this ticket.

            Assignee:
            Unassigned Unassigned
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: