Class: Ductr::Log::ColorFormatter

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/ductr/log/formatters/color_formatter.rb

Overview

A log formatter which colorize the text with ANSI colors.

Instance Method Summary collapse

Instance Method Details

#call(level, time, prog_name, message) ⇒ String

Colorizes the given log entry.

Parameters:

  • level (Integer)

    The log’s severity level

  • time (Time)

    The log’s timestamp

  • prog_name (Symbol)

    The log’s “program” name, used to add job method name to the log

  • message (String)

    The log’s message

Returns:

  • (String)

    The formatted log



22
23
24
# File 'lib/ductr/log/formatters/color_formatter.rb', line 22

def call(level, time, prog_name, message)
  format(format_str(level), level[0], format_datetime(time), Process.pid, level, prog_name, msg2str(message))
end