Class: DfcLogFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/dfc_log/dfc_log_formatter.rb

Overview

N.B. we limit log message length to 2500 characters

Constant Summary collapse

SEVERITY_TO_COLOR_MAP =
{ 'DEBUG' => '0;37', 'INFO' => '32',
'WARN' => '33', 'ERROR' => '31',
'FATAL' => '31', 'UNKNOWN' => '37' }.freeze

Instance Method Summary collapse

Instance Method Details

#call(severity, time, _progname, msg) ⇒ Object



7
8
9
10
11
12
# File 'lib/dfc_log/dfc_log_formatter.rb', line 7

def call(severity, time, _progname, msg)
  msg = 'BLANK MESSAGE' if msg.blank?
  msg = msg.strip

  Rails.env.production? ? log_non_local(severity, msg) : log_local(severity, time, msg)
end