Sha256: 4b19053157f95b9c52866fdd03622edff9901406cca59640ae1bc03525de6858

Contents?: true

Size: 645 Bytes

Versions: 5

Compression:

Stored size: 645 Bytes

Contents

module Astrobot
  class Logger
    def self.add(message)
      Kernel.puts "[TransmissionApi #{Time.now.strftime( "%F %T" )}] #{message}" if Astrobot.config[:debug_mode]
    end

    def self.debug(response)
      body = nil
      begin
        body = JSON.parse(response.body).to_yaml
      rescue
        body = response.body
      end

      headers = response.headers.to_yaml

      add "response.code: #{response.code}"
      add "response.message: #{response.message}"

      add "response.body:"
      add body
      add "-----------------"

      add "response.headers:"
      add headers
      add "------------------"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
astrobot-0.1.4 lib/astrobot/logger.rb
astrobot-0.1.3 lib/astrobot/logger.rb
astrobot-0.1.2 lib/astrobot/logger.rb
astrobot-0.1.1 lib/astrobot/logger.rb
astrobot-0.0.5 lib/astrobot/logger.rb