Class

Logger

Inheritance
< Object

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 & Modules

Aliases

Method Alias Description
datetime_format → old_datetime_format
datetime_format= → old_datetime_format=
format_datetime → old_format_datetime
format_message → old_format_message
formatter → old_formatter
msg2str → old_msg2str

Methods

Class

Visibility Signature
public define_around_helper (level)

Instance

Visibility Signature
public datetime_format ()
public datetime_format= (datetime_format)
public formatter ()
public silence (temporary_level = Logger::ERROR) {|self| ...}

Class Method Detail

define_around_helper(level)

Instance Method Detail

datetime_format()

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

datetime_format=(datetime_format)

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

formatter()

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

silence(temporary_level = Logger::ERROR) {|self| ...}

Silences the logger for the duration of the block.