Class: ActiveSupport::Logger
- Includes:
- LoggerSilence
- Defined in:
- lib/active_support/logger.rb
Direct Known Subclasses
Defined Under Namespace
Classes: SimpleFormatter
Class Method Summary collapse
-
.broadcast(logger) ⇒ Object
Broadcasts logs to multiple loggers.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Logger
constructor
A new instance of Logger.
Methods included from LoggerSilence
Methods included from Concern
#append_features, extended, #included
Methods inherited from Logger
#datetime_format, #datetime_format=, define_around_helper, #old_datetime_format, #old_datetime_format=, #old_initialize
Constructor Details
#initialize(*args) ⇒ Logger
Returns a new instance of Logger.
44 45 46 47 |
# File 'lib/active_support/logger.rb', line 44 def initialize(*args) super @formatter = SimpleFormatter.new end |
Class Method Details
.broadcast(logger) ⇒ Object
Broadcasts logs to multiple loggers.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/active_support/logger.rb', line 10 def self.broadcast(logger) # :nodoc: Module.new do define_method(:add) do |*args, &block| logger.add(*args, &block) super(*args, &block) end define_method(:<<) do |x| logger << x super(x) end define_method(:close) do logger.close super() end define_method(:progname=) do |name| logger.progname = name super(name) end define_method(:formatter=) do |formatter| logger.formatter = formatter super(formatter) end define_method(:level=) do |level| logger.level = level super(level) end end end |