Sha256: dbe9c610f32c2918fdd8e51cde1a33011d2233639695a87ab54e7bfeec01d5eb

Contents?: true

Size: 498 Bytes

Versions: 12

Compression:

Stored size: 498 Bytes

Contents

require 'json'

class ResponseLogger

  def initialize(log_path)
    @path = log_path
  end

  def log(call, code, response)
    check_log_file "#{@path}/veracodecli.log"
    log = File.open "#{@path}/veracodecli.log", 'a+'
    log.write "#{call} called @ #{timestamp}"
    log.write "HTTP #{code}\n"
    log.write response
    log.write "\n"
    log.close
  end

  def check_log_file(file_path)
    File.open file_path, 'w' unless File.exist? file_path
  end

  def timestamp
    `date`
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
veracodecli-1.0.22 lib/veracodecli/log.rb
veracodecli-1.0.21 lib/veracodecli/log.rb
veracodecli-1.0.20 lib/veracodecli/log.rb
veracodecli-1.0.19 lib/veracodecli/log.rb
veracodecli-1.0.18 lib/veracodecli/log.rb
veracodecli-1.0.17 lib/veracodecli/log.rb
veracodecli-1.0.16 lib/veracodecli/log.rb
veracodecli-1.0.15 lib/veracodecli/log.rb
veracodecli-1.0.14 lib/veracodecli/log.rb
veracodecli-1.0.13 lib/veracodecli/log.rb
veracodecli-1.0.12 lib/veracodecli/log.rb
veracodecli-1.0.11 lib/veracodecli/log.rb