Sha256: 1f402212129f7093b218f620dbc99d02a720d3c6c9b770009425897a976d2000
Contents?: true
Size: 649 Bytes
Versions: 12
Compression:
Stored size: 649 Bytes
Contents
module HTTParty module Logging def self.logging_env ENV["HTTPARTY_LOGGING"] end def self.enabled? logging_env end def self.destination unless @destination if(logging_env == "stdout") @destination = STDOUT else @destination = File.open(logging_env, 'a') at_exit{@destination.close} end end @destination end def self.log(string) destination.puts(string) end def record_log if Logging.enabled? record = [] yield(record) Logging.log(record.join("\n")) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems