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

Classes and Modules
Class Logger::Formatter
Class Logger::SimpleFormatter
Public Class methods
   # File activesupport/lib/active_support/core_ext/logger.rb, line 4
4:   def self.define_around_helper(level)
5:     module_eval "def around_\#{level}(before_message, after_message, &block)  # def around_debug(before_message, after_message, &block)\nself.\#{level}(before_message)                             #   self.debug(before_message)\nreturn_value = block.call(self)                           #   return_value = block.call(self)\nself.\#{level}(after_message)                              #   self.debug(after_message)\nreturn return_value                                       #   return return_value\nend                                                         # end\n"
6:   end
Public Instance methods

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

    # File activesupport/lib/active_support/core_ext/logger.rb, line 64
64:   def datetime_format
65:     formatter.datetime_format if formatter.respond_to?(:datetime_format)
66:   end

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

    # File activesupport/lib/active_support/core_ext/logger.rb, line 57
57:   def datetime_format=(datetime_format)
58:     formatter.datetime_format = datetime_format if formatter.respond_to?(:datetime_format=)
59:   end

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

    # File activesupport/lib/active_support/core_ext/logger.rb, line 71
71:   def formatter
72:     @formatter ||= SimpleFormatter.new
73:   end
silence(temporary_level = Logger::ERROR) {|self| ...}

Silences the logger for the duration of the block.

    # File activesupport/lib/active_support/core_ext/logger.rb, line 41
41:   def silence(temporary_level = Logger::ERROR)
42:     if silencer
43:       begin
44:         old_logger_level, self.level = level, temporary_level
45:         yield self
46:       ensure
47:         self.level = old_logger_level
48:       end
49:     else
50:       yield self
51:     end
52:   end