Skip to content

Commit

Permalink
PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
Edouard-chin committed Jan 17, 2024
1 parent cfdc3e1 commit ac23c0d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions activesupport/lib/active_support/broadcast_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ module ActiveSupport
# configured in such a way).
# Tagging your logs can be done for the whole broadcast or for each sink independently.
#
# Tagging logs for the whole broadcast
# Tagging logs for the whole broadcast:
#
# broadcast = BroadcastLogger.new(stdout_logger, file_logger)
# broadcast.tagged("BMX") { broadcast.info("Hello world!") }
#
# Outputs: "[BMX] Hello world!" is written on both STDOUT and in the file.
#
# Tagging logs for a single logger
# Tagging logs for a single logger:
#
# stdout_logger.extend(ActiveSupport::TaggedLogging)
# stdout_logger.push_tags("BMX")
Expand All @@ -98,7 +98,7 @@ module ActiveSupport
# Outputs: "[BMX] Hello world!" is written on STDOUT
# Outputs: "Hello world!" is written in the file
#
# Adding tags for the whole broadcast and adding extra tags on a specific logger
# Adding tags for the whole broadcast and adding extra tags on a specific logger:
#
# stdout_logger.extend(ActiveSupport::TaggedLogging)
# stdout_logger.push_tags("BMX")
Expand Down Expand Up @@ -129,6 +129,10 @@ def initialize(*loggers)
# broadcast_logger = ActiveSupport::BroadcastLogger.new
# broadcast_logger.broadcast_to(Logger.new(STDOUT), Logger.new(STDERR))
def broadcast_to(*loggers)
loggers.each do |logger|
logger.extend(LogProcessor) unless logger.is_a?(LogProcessor)
end

@broadcasts.concat(loggers)
end

Expand Down Expand Up @@ -271,7 +275,6 @@ def dispatch(&block)

def dispatch_with_processors(&block)
@broadcasts.each do |logger|
logger.extend(LogProcessor) unless logger.is_a?(LogProcessor)
logger.processors.unshift(processors)

block.call(logger)
Expand Down

0 comments on commit ac23c0d

Please sign in to comment.