Class: ResponseLogger

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

Instance Method Summary collapse

Instance Method Details

#object_log(code = nil, body) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/apidragon/log.rb', line 3

def object_log(code=nil, body)
  body = JSON.parse body
  log = File.open "#{LOG}", 'a+'
  log.write "call @ #{timestamp}"
  log.write "HTTP #{code}\n" unless code==nil
  log.write JSON.pretty_generate body
  log.write "\n"
  log.close
end

#timestampObject



13
14
15
# File 'lib/apidragon/log.rb', line 13

def timestamp
  `date`
end