-
Notifications
You must be signed in to change notification settings - Fork 110
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
activejob: Add types for ActiveJob::Logging #732
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
logger
is defined usingClass#cattr_accessor
in activesupport with instance_reader/instance_writer/instance_accessor set to true.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 usingClass#class_attribute
in activesupport with instance_accessor set to false and instance_predicate set to true.