Class: Startback::Support::LogFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/startback/support/log_formatter.rb

Instance Method Summary collapse

Instance Method Details

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



5
6
7
8
9
10
11
12
13
14
# File 'lib/startback/support/log_formatter.rb', line 5

def call(severity, time, progname, msg)
  if msg[:error] && msg[:error].respond_to?(:message, true)
    msg[:backtrace] = msg[:error].backtrace[0..25] if severity == "FATAL"
    msg[:error] = msg[:error].message
  end
  {
    severity: severity,
    time: time,
  }.merge(msg).to_json << "\n"
end