Class: Wright::Logger::Formatter Private

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/wright/logger.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Default formatter for Wright log messages.

Instance Method Summary collapse

Instance Method Details

#call(severity, _time, _progname, message) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method is called by Wright::Logger to format log messages.

Parameters:

  • severity (String)

    the log entry’s severity

  • _time (Time)

    the log entry’s time stamp (ignored)

  • _progname (String)

    the log entry’s program name (ignored)

  • message (String)

    the log message

Returns:

  • (String)

    the formatted log entry



21
22
23
24
25
26
27
28
# File 'lib/wright/logger.rb', line 21

def call(severity, _time, _progname, message)
  log_entry = "#{severity}: #{message}\n"
  if Wright::Config[:log][:colorize]
    colorize(log_entry, severity)
  else
    log_entry
  end
end