Class: ResponseLogger
- Inherits:
-
Object
- Object
- ResponseLogger
- Defined in:
- lib/veracodecli/log.rb
Instance Method Summary collapse
- #check_log_file(file_path) ⇒ Object
-
#initialize(log_path) ⇒ ResponseLogger
constructor
A new instance of ResponseLogger.
- #log(call, code, response) ⇒ Object
- #timestamp ⇒ Object
Constructor Details
#initialize(log_path) ⇒ ResponseLogger
Returns a new instance of ResponseLogger.
5 6 7 |
# File 'lib/veracodecli/log.rb', line 5 def initialize(log_path) @path = log_path end |
Instance Method Details
#check_log_file(file_path) ⇒ Object
19 20 21 |
# File 'lib/veracodecli/log.rb', line 19 def check_log_file(file_path) File.open file_path, 'w' unless File.exist? file_path end |
#log(call, code, response) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/veracodecli/log.rb', line 9 def log(call, code, response) check_log_file "#{@path}/veracodecli.log" log = File.open "#{@path}/veracodecli.log", 'a+' log.write "#{call} called @ #{}" log.write "HTTP #{code}\n" log.write response log.write "\n" log.close end |
#timestamp ⇒ Object
23 24 25 |
# File 'lib/veracodecli/log.rb', line 23 def `date` end |