Sha256: 906d3e733dcc8f89c64e4a05987fdfd5127ca43aade16d7671914ef46e3a3ba5
Contents?: true
Size: 581 Bytes
Versions: 7
Compression:
Stored size: 581 Bytes
Contents
# frozen_string_literal: true module HTTPX module Loggable COLORS = { black: 30, red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, white: 37, }.freeze def log(level: @options.debug_level, label: "", color: nil, &msg) return unless @options.debug return unless @options.debug_level >= level message = (+label << msg.call << "\n") message = "\e[#{COLORS[color]}m#{message}\e[0m" if color && @options.debug.isatty @options.debug << message end end end
Version data entries
7 entries across 7 versions & 1 rubygems