Skip to content

Commit 69d904e

Browse files
authored
Merge pull request rails#49854 from skipkayhil/hm-document-aj-logger
Document ActiveJob::Base#logger and #log_arguments
2 parents 8950070 + ac916c6 commit 69d904e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

activejob/lib/active_job/logging.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,31 @@
44
require "active_support/logger"
55

66
module ActiveJob
7-
module Logging # :nodoc:
7+
module Logging
88
extend ActiveSupport::Concern
99

1010
included do
11+
##
12+
# Accepts a logger conforming to the interface of Log4r or the default
13+
# Ruby +Logger+ class. You can retrieve this logger by calling +logger+ on
14+
# either an Active Job job class or an Active Job job instance.
1115
cattr_accessor :logger, default: ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT))
16+
17+
##
18+
# Configures whether a job's arguments should be logged. This can be
19+
# useful when a job's arguments may be sensitive and so should not be
20+
# logged.
21+
#
22+
# The value defaults to +true+, but this can be configured with
23+
# +config.active_job.log_arguments+. Additionally, individual jobs can
24+
# also configure a value, which will apply to themselves and any
25+
# subclasses.
1226
class_attribute :log_arguments, instance_accessor: false, default: true
1327

1428
around_enqueue(prepend: true) { |_, block| tag_logger(&block) }
1529
end
1630

17-
def perform_now
31+
def perform_now # :nodoc:
1832
tag_logger(self.class.name, self.job_id) { super }
1933
end
2034

0 commit comments

Comments
 (0)