Class: Dynamoid::Log::Formatter::Debug

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamoid/log/formatter.rb

Instance Method Summary collapse

Instance Method Details

#format(response) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/dynamoid/log/formatter.rb', line 10

def format(response)
  bold = "\x1b[1m"
  color = "\x1b[34m"
  reset = "\x1b[0m"

  [
    response.context.operation.name,
    "#{bold}#{color}\nRequest:\n#{reset}#{bold}",
    JSON.pretty_generate(JSON.parse(response.context.http_request.body.string)),
    "#{bold}#{color}\nResponse:\n#{reset}#{bold}",
    JSON.pretty_generate(JSON.parse(response.context.http_response.body.string)),
    reset
  ].join("\n")
end