Class: ActiveSupport::Logger
- Includes:
- LoggerSilence
- Defined in:
- activesupport/lib/active_support/logger.rb
Defined Under Namespace
Classes: SimpleFormatter
Class Method Summary collapse
-
.logger_outputs_to?(logger, *sources) ⇒ Boolean
Returns true if the logger destination matches one of the sources.
Instance Method Summary collapse
-
#initialize(*args, **kwargs) ⇒ Logger
constructor
A new instance of Logger.
Methods included from LoggerSilence
Methods included from Concern
#append_features, #class_methods, extended, #included, #prepend_features, #prepended
Constructor Details
#initialize(*args, **kwargs) ⇒ Logger
Returns a new instance of Logger.
22 23 24 25 |
# File 'activesupport/lib/active_support/logger.rb', line 22 def initialize(*args, **kwargs) super @formatter ||= SimpleFormatter.new end |
Class Method Details
.logger_outputs_to?(logger, *sources) ⇒ Boolean
Returns true if the logger destination matches one of the sources
logger = Logger.new(STDOUT)
ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT)
# => true
16 17 18 19 20 |
# File 'activesupport/lib/active_support/logger.rb', line 16 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 |