Sha256: 242037afa97ab22b4508b452587f8a01d06570fd7a472b6e3c03d76893feb8cd

Contents?: true

Size: 1.63 KB

Versions: 15

Compression:

Stored size: 1.63 KB

Contents

# encoding: utf-8
module Ayadn
  class Debug

    def self.skipped dic
      if Settings.options[:timeline][:debug] == true
        Logs.rec.debug "SKIPPED: #{dic.keys.first.to_s.capitalize} => #{dic.values.first}"
      end
    end

    def self.http response, url
      if Settings.options[:timeline][:debug] == true
        deb = "\n"
        deb << "+ HTTP\n"
        deb << "* t#{Time.now.to_i}\n"
        deb << "Url: #{url}\n"
        deb << "Code: #{response.code}\n"
        deb << "\n"
        puts deb.color(:green)
        Logs.rec.debug "HTTP/URL: #{url}"
        Logs.rec.debug "HTTP/HEADERS: #{response.headers}"
      end
    end

    def self.err error, stack
      # Logs.rec.debug "+DEBUG STACK: #{stack}"
      if Settings.options[:timeline][:debug] == true
        puts "\nDEBUG:\n"
        puts error.inspect
        raise error
        # puts "\nSTACK:\n"
        # puts stack
        # puts "\n--*--\n\n"
      end
    end

    def self.stream(stream, options, target)
      if Settings.options[:timeline][:debug] == true
        deb = "\n"
        deb << "+ STREAM\n"
        deb << "* t#{Time.now.to_i}\n"
        deb << "Options:\t#{options.inspect}\n"
        deb << "Target:\t\t#{target.inspect}\n"
        deb << "Posts:\t\t#{stream['data'].length}\n"
        deb << "Meta:\t\t#{stream['meta']}\n"
        deb << "\n"
        puts deb.color(Settings.options[:colors][:debug])
        Logs.rec.debug "STREAM/META: #{stream['meta']}"
        Logs.rec.debug "STREAM/OPTIONS: #{options.inspect}"
        Logs.rec.debug "STREAM/TARGET: #{target.inspect}"
        Logs.rec.debug "STREAM/POSTS: #{stream['data'].length}"
      end
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ayadn-3.0 lib/ayadn/debug.rb
ayadn-2.1 lib/ayadn/debug.rb
ayadn-2.0.12 lib/ayadn/debug.rb
ayadn-2.0.11 lib/ayadn/debug.rb
ayadn-2.0.10 lib/ayadn/debug.rb
ayadn-2.0.9 lib/ayadn/debug.rb
ayadn-2.0.8 lib/ayadn/debug.rb
ayadn-2.0.7 lib/ayadn/debug.rb
ayadn-2.0.6 lib/ayadn/debug.rb
ayadn-2.0.5 lib/ayadn/debug.rb
ayadn-2.0.4 lib/ayadn/debug.rb
ayadn-2.0.3 lib/ayadn/debug.rb
ayadn-2.0.2 lib/ayadn/debug.rb
ayadn-2.0.1 lib/ayadn/debug.rb
ayadn-2.0 lib/ayadn/debug.rb