Adds the 'around_level' method to Logger.

Extensions to the built in Ruby logger.

If you want to use the default log formatter as defined in the Ruby core, then you will need to set the formatter for the logger as in:

logger.formatter = Formatter.new

You can then specify the datetime format, for example:

logger.datetime_format = "%Y-%m-%d"

Note: This logger is deprecated in favor of ActiveSupport::BufferedLogger

Namespace
Methods
D
F
O
S
Class Public methods
define_around_helper(level)
# File activesupport/lib/active_support/core_ext/logger.rb, line 4
def self.define_around_helper(level)
  module_eval <<-end_eval
    def around_#{level}(before_message, after_message, &block)  # def around_debug(before_message, after_message, &block)
      self.#{level}(before_message)                             #   self.debug(before_message)
      return_value = block.call(self)                           #   return_value = block.call(self)
      self.#{level}(after_message)                              #   self.debug(after_message)
      return return_value                                       #   return return_value
    end                                                         # end
  end_eval
end
silencer

Set to false to disable the silencer

# File activesupport/lib/active_support/core_ext/logger.rb, line 36
cattr_accessor :silencer
Instance Public methods
datetime_format()

Get the logging datetime format. Returns nil if the formatter does not support datetime formatting.

Also aliased as: old_datetime_format
# File activesupport/lib/active_support/core_ext/logger.rb, line 63
def datetime_format
  formatter.datetime_format if formatter.respond_to?(:datetime_format)
end
datetime_format=(datetime_format)

Logging date-time format (string passed to strftime). Ignored if the formatter does not respond to #datetime_format=.

Also aliased as: old_datetime_format=
# File activesupport/lib/active_support/core_ext/logger.rb, line 56
def datetime_format=(datetime_format)
  formatter.datetime_format = datetime_format if formatter.respond_to?(:datetime_format=)
end
formatter()

Get the current formatter. The default formatter is a SimpleFormatter which only displays the log message

Also aliased as: old_formatter
# File activesupport/lib/active_support/core_ext/logger.rb, line 70
def formatter
  @formatter ||= SimpleFormatter.new
end
old_datetime_format()
old_datetime_format=(datetime_format)
old_formatter()
silence(temporary_level = Logger::ERROR)

Silences the logger for the duration of the block.

# File activesupport/lib/active_support/core_ext/logger.rb, line 40
def silence(temporary_level = Logger::ERROR)
  if silencer
    begin
      old_logger_level, self.level = level, temporary_level
      yield self
    ensure
      self.level = old_logger_level
    end
  else
    yield self
  end
end