activejob: Add types for ActiveJob::Logging #732
activejob: Add types for ActiveJob::Logging #732sanfrecce-osaka wants to merge 2 commits intoruby:mainfrom
Conversation
- `logger` is defined using `Class#cattr_accessor` in activesupport with instance_reader/instance_writer/instance_accessor set to true. - The default for `logger` is ActiveSupport::TaggedLogging, but it is not necessarily an instance of ActiveSupport::TaggedLogging or an inheritor of ActiveSupport::TaggedLogging (e.g. lograge). Therefore, it is defined as untyped. - `log_arguments` is defined using `Class#class_attribute` in activesupport with instance_accessor set to false and instance_predicate set to true.
|
@sanfrecce-osaka Thanks for your contribution! Please follow the instructions below for each change. Available commandsYou can use the following commands by commenting on this PR.
|
| def log_arguments: () -> bool | ||
| def log_arguments=: (bool value) -> bool | ||
| def log_arguments?: () -> bool |
There was a problem hiding this comment.
Sadly, .log_arguments was added in v6.1.
rails/rails@ce085f6
Therefore it's not good to add here. Please add 6.1/ or newer directory if you need to use this method.
| def logger: () -> untyped | ||
| def logger=: (untyped val) -> untyped |
There was a problem hiding this comment.
FYI: The API doc says:
Accepts a logger conforming to the interface of Log4r or the default Ruby Logger class. You can retrieve this logger by calling logger on either an Active Job job class or an Active Job job instance.
https://api.rubyonrails.org/classes/ActiveJob/Logging.html#method-i-logger
I'm not sure "the interface of Log4r". So I'm okay to keep this untyped.

loggeris defined usingClass#cattr_accessorin activesupport with instance_reader/instance_writer/instance_accessor set to true.loggeris ActiveSupport::TaggedLogging, but it is not necessarily an instance of ActiveSupport::TaggedLogging or an inheritor of ActiveSupport::TaggedLogging (e.g. lograge). Therefore, it is defined as untyped.log_argumentsis defined usingClass#class_attributein activesupport with instance_accessor set to false and instance_predicate set to true.