Module: HTTPX::Loggable
- Included in:
- Channel, Channel::HTTP1, Channel::HTTP2, Client, ErrorResponse, TCP
- Defined in:
- lib/httpx/loggable.rb
Constant Summary collapse
- COLORS =
{ black: 30, red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, white: 37, }.freeze
Instance Method Summary collapse
Instance Method Details
#log(level: @options.debug_level, label: "", color: nil, &msg) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/httpx/loggable.rb', line 16 def log(level: @options.debug_level, label: "", color: nil, &msg) return unless @options.debug return unless @options.debug_level >= level = (+label << msg.call << "\n") = "\e[#{COLORS[color]}m#{}\e[0m" if color && @options.debug.isatty @options.debug << end |