Skip to content

Commit

Permalink
Add comments for logger_outputs_to?
Browse files Browse the repository at this point in the history
  • Loading branch information
bmulvihill committed Jun 5, 2016
1 parent 2e25e44 commit b8a53bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion activesupport/lib/active_support/logger.rb
Expand Up @@ -6,12 +6,17 @@ module ActiveSupport
class Logger < ::Logger
include LoggerSilence

# Returns true if the logger destination matches one of the sources
#
# logger = Logger.new(STDOUT)
# ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT)
# # => true
def self.logger_outputs_to?(logger, *sources)
logdev = logger.instance_variable_get("@logdev")
logger_source = logdev.dev if logdev.respond_to?(:dev)
sources.any? { |source| source == logger_source }
end

# Broadcasts logs to multiple loggers.
def self.broadcast(logger) # :nodoc:
Module.new do
Expand Down

0 comments on commit b8a53bb

Please sign in to comment.