debugged-ruby 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/debugged-ruby/version.rb +1 -1
- data/lib/debugged-ruby.rb +7 -12
- metadata +1 -1
data/lib/debugged-ruby.rb
CHANGED
@@ -10,7 +10,6 @@ module Debugged
|
|
10
10
|
@@api_key = nil
|
11
11
|
|
12
12
|
def self.api_key=(api_key)
|
13
|
-
puts 'SOUNDS LEGIT TO ME'
|
14
13
|
@@api_key = api_key
|
15
14
|
end
|
16
15
|
|
@@ -18,20 +17,14 @@ module Debugged
|
|
18
17
|
@@api_key
|
19
18
|
end
|
20
19
|
|
21
|
-
def self.report(
|
20
|
+
def self.report(e, data=nil)
|
22
21
|
|
23
|
-
unless data.is_a? Hash
|
22
|
+
unless data.is_a? Hash or data.nil?
|
24
23
|
#Log this
|
25
24
|
raise ArgumentError, 'Data argument is not Hash'
|
26
25
|
end
|
27
26
|
|
28
|
-
|
29
|
-
#Log this
|
30
|
-
raise ArgumentError, 'Name argument is not String'
|
31
|
-
end
|
32
|
-
|
33
|
-
name ||= ""
|
34
|
-
data ||= ""
|
27
|
+
data ||= {}
|
35
28
|
|
36
29
|
time = Time.now.utc.to_i
|
37
30
|
hash = Digest::SHA1.base64digest @@api_key.to_s+name+"ruby"+time.to_s
|
@@ -40,14 +33,14 @@ module Debugged
|
|
40
33
|
{
|
41
34
|
"created_at" => time,
|
42
35
|
"identifier" => hash,
|
43
|
-
"exception_name" =>
|
36
|
+
"exception_name" => e.class.to_s,
|
44
37
|
"sdk_version" => "ruby",
|
45
38
|
"stack_trace" => e.backtrace.join("\n"),
|
46
39
|
"message" => e.message,
|
47
40
|
"line_number" => e.backtrace[0].split(":").last.to_i,
|
48
41
|
"character_number" => -1,
|
49
42
|
"filename" => e.backtrace[0].split("/").last.split(":").first,
|
50
|
-
"user_custom_data" => data,
|
43
|
+
"user_custom_data" => data.to_json,
|
51
44
|
"sdk_data" => {"ruby_version" => RUBY_VERSION.to_s,
|
52
45
|
"platform" => RUBY_PLATFORM.to_s}
|
53
46
|
}
|
@@ -67,6 +60,8 @@ module Debugged
|
|
67
60
|
#do something
|
68
61
|
end
|
69
62
|
|
63
|
+
puts report.to_json
|
64
|
+
puts res.inspect
|
70
65
|
"debugged.herokuapp.com/report/"+hash.to_s
|
71
66
|
end
|
72
67
|
#
|