-
Type: Improvement
-
Resolution: Duplicate
-
Priority: 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.
- duplicates
-
MONGOID-5169 Instrument deprecations with ActiveSupport::Deprecation functionality
- Closed
- related to
-
MONGOID-4737 Deprecate Document#as_json :compact option
- Closed
-
MONGOID-5144 Add deprecation warning when the legacy Mongoid query cache is used
- Closed