Module: ApiHammer::RequestLoggerHelper
- Included in:
- Faraday::RequestLogger, RequestLogger
- Defined in:
- lib/api_hammer/request_logger.rb
Instance Method Summary collapse
Instance Method Details
#log_bodies(status) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/api_hammer/request_logger.rb', line 8 def log_bodies(status) if @options[:log_bodies] == :on_error (400..599).include?(status.to_i) elsif @options.key?(:log_bodies) @options[:log_bodies] else true end end |
#status_s(status) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/api_hammer/request_logger.rb', line 18 def status_s(status) status_color = case status.to_i when 200..299 :intense_green when 400..499 :intense_yellow when 500..599 :intense_red else :white end bold(send(status_color, status.to_s)) end |