Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions gems/activejob/6.0/_test/activejob.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ def around_task
end

SendMessageJob.perform_now
SendMessageJob.logger
SendMessageJob.logger = ActiveSupport::Logger.new(STDOUT)
SendMessageJob.log_arguments = false
SendMessageJob.log_arguments
SendMessageJob.log_arguments?
SendMessageJob.set(queue: :another_queue).perform_later(flag: false)
job = SendMessageJob.new(flag: false)
job.logger
job.logger = ActiveSupport::Logger.new(STDOUT)
9 changes: 0 additions & 9 deletions gems/activejob/6.0/activejob-generated.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -630,15 +630,6 @@ end

module ActiveJob
module Logging
# nodoc:
extend ActiveSupport::Concern

private

def tag_logger: (*untyped tags) { () -> untyped } -> untyped

def logger_tagged_by_active_job?: () -> untyped

class LogSubscriber < ActiveSupport::LogSubscriber
# nodoc:
def enqueue: (untyped event) -> untyped
Expand Down
26 changes: 26 additions & 0 deletions gems/activejob/6.0/activejob.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module ActiveJob
extend ActiveJob::QueueAdapter::ClassMethods
extend ActiveJob::QueueName::ClassMethods
extend ActiveJob::QueuePriority::ClassMethods
extend ActiveJob::Logging::ClassMethods
include ActiveJob::Logging

def self.queue_as: (*untyped) -> void | ...
def self.queue_with_priority: (?untyped? priority) -> void | ...
Expand All @@ -21,3 +23,27 @@ module ActiveJob
def self.discard_on: (*untyped) -> void | ...
end
end

module ActiveJob
module Logging
# nodoc:
extend ActiveSupport::Concern

module ClassMethods
def logger: () -> untyped
def logger=: (untyped val) -> untyped
Comment on lines +33 to +34
Copy link
Contributor

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.

def log_arguments: () -> bool
def log_arguments=: (bool value) -> bool
def log_arguments?: () -> bool
Comment on lines +35 to +37
Copy link
Contributor

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.

end

def logger: () -> untyped
def logger=: (untyped val) -> untyped

private

def tag_logger: (*Array[String] tags) { () -> untyped } -> untyped

def logger_tagged_by_active_job?: () -> bool
end
end