class ActiveSupport::Logger
Inherits From
-
class
Logger
-
module
ActiveSupport::
LoggerSilence
Public class methods
Returns true if the logger destination matches one of the sources
logger = Logger.new(STDOUT)
ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT)
# => true
Source code GitHub
# File activesupport/lib/active_support/logger.rb, line 16
def self.logger_outputs_to?(logger, *sources)
loggers = if logger.is_a?(BroadcastLogger)
logger.broadcasts
else
[logger]
end
logdevs = loggers.map { |logger| logger.instance_variable_get(:@logdev) }
logger_sources = logdevs.filter_map { |logdev| logdev.dev if logdev.respond_to?(:dev) }
(sources & logger_sources).any?
end
Source code GitHub
# File activesupport/lib/active_support/logger.rb, line 29
def initialize(*args, **kwargs)
super
@formatter ||= SimpleFormatter.new
end