Class: Ayadn::Debug

Inherits:
Object show all
Defined in:
lib/ayadn/debug.rb

Class Method Summary collapse

Class Method Details

.err(error, stack) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ayadn/debug.rb', line 25

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

.http(response, url) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ayadn/debug.rb', line 11

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

.skipped(dic) ⇒ Object



5
6
7
8
9
# File 'lib/ayadn/debug.rb', line 5

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

.stream(stream, options, target) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ayadn/debug.rb', line 37

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