Class: ActiveSupport::Logger
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Logger
|
|
Instance Chain:
self,
LoggerThreadSafeLevel ,
LoggerSilence ,
Logger
|
|
Inherits: |
Logger
|
Defined in: | activesupport/lib/active_support/logger.rb |
LoggerSilence
- Attributes & Methods
Class Method Summary
-
.logger_outputs_to?(logger, *sources) ⇒ Boolean
Returns true if the logger destination matches one of the sources.
- .new(*args, **kwargs) ⇒ Logger constructor
- .normalize_sources(sources) private
Instance Attribute Summary
Instance Method Summary
LoggerThreadSafeLevel
- self
#level, | |
#log_at | Change the thread-local level for the duration of the given block. |
#local_level_key |
LoggerSilence
- Included
#silence | Silences the logger for the duration of the block. |
Constructor Details
.new(*args, **kwargs) ⇒ Logger
# File 'activesupport/lib/active_support/logger.rb', line 33
def initialize(*args, **kwargs) super @formatter ||= SimpleFormatter.new end
Class Attribute Details
.silencer (rw) Also known as: #silencer
[ GitHub ]# File 'activesupport/lib/active_support/logger_silence.rb', line 12
cattr_accessor :silencer, default: true
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
logger = Logger.new('/var/log/rails.log')
ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
# => true
# File 'activesupport/lib/active_support/logger.rb', line 20
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.try(:filename) || logdev.try(:dev) } normalize_sources(sources).intersect?(normalize_sources(logger_sources)) end
.normalize_sources(sources) (private)
[ GitHub ]Instance Attribute Details
#silencer (rw)
[ GitHub ]# File 'activesupport/lib/active_support/logger_silence.rb', line 12
cattr_accessor :silencer, default: true