error_stalker 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
error_stalker (0.0.
|
4
|
+
error_stalker (0.0.14)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
@@ -15,7 +15,7 @@ GEM
|
|
15
15
|
activesupport (= 3.0.3)
|
16
16
|
activesupport (3.0.3)
|
17
17
|
addressable (2.2.2)
|
18
|
-
bson (1.2
|
18
|
+
bson (1.6.2)
|
19
19
|
builder (2.1.2)
|
20
20
|
daemons (1.1.0)
|
21
21
|
eventmachine (0.12.10)
|
@@ -32,13 +32,12 @@ GEM
|
|
32
32
|
mime-types (1.16)
|
33
33
|
mocha (0.9.10)
|
34
34
|
rake
|
35
|
-
mongo (1.2
|
36
|
-
bson (
|
37
|
-
mongoid (2.
|
38
|
-
activemodel (~> 3.0)
|
39
|
-
mongo (~> 1.
|
35
|
+
mongo (1.6.2)
|
36
|
+
bson (~> 1.6.2)
|
37
|
+
mongoid (2.2.6)
|
38
|
+
activemodel (~> 3.0.0)
|
39
|
+
mongo (~> 1.3)
|
40
40
|
tzinfo (~> 0.3.22)
|
41
|
-
will_paginate (~> 3.0.pre)
|
42
41
|
polyglot (0.3.1)
|
43
42
|
rack (1.2.1)
|
44
43
|
rack-test (0.5.7)
|
@@ -54,10 +53,10 @@ GEM
|
|
54
53
|
tilt (1.2.1)
|
55
54
|
treetop (1.4.9)
|
56
55
|
polyglot (>= 0.3.1)
|
57
|
-
tzinfo (0.3.
|
56
|
+
tzinfo (0.3.33)
|
58
57
|
vegas (0.1.8)
|
59
58
|
rack (>= 1.0.0)
|
60
|
-
will_paginate (3.0.
|
59
|
+
will_paginate (3.0.3)
|
61
60
|
|
62
61
|
PLATFORMS
|
63
62
|
ruby
|
@@ -69,8 +68,9 @@ DEPENDENCIES
|
|
69
68
|
lighthouse-api (= 2.0)
|
70
69
|
mail (~> 2.2.15)
|
71
70
|
mocha (~> 0.9.10)
|
72
|
-
mongoid (
|
71
|
+
mongoid (~> 2.2.0)
|
73
72
|
rack-test (~> 0.5.7)
|
74
73
|
sinatra (~> 1.1.2)
|
75
74
|
thin (~> 1.2.7)
|
76
75
|
vegas (~> 0.1.8)
|
76
|
+
will_paginate (~> 3.0)
|
data/lib/error_stalker/client.rb
CHANGED
@@ -57,6 +57,6 @@ end
|
|
57
57
|
logfile = File.join(Dir.tmpdir, "exceptions.log")
|
58
58
|
|
59
59
|
# let's put this in a better place if we're using rails
|
60
|
-
logfile = Rails.root + 'log/exceptions.log' if defined?(Rails)
|
60
|
+
logfile = Rails.root + 'log/exceptions.log' if defined?(Rails) && Rails.root
|
61
61
|
|
62
62
|
ErrorStalker::Client.backend = ErrorStalker::Backend::LogFile.new(logfile)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<p><a href="/">Back to list</a></p>
|
2
|
-
<h1>Exception in
|
2
|
+
<h1>Exception<%= " in #{h @report.application}" unless @report.application.empty? %></h1>
|
3
3
|
<h3>on <%= h @report.machine %> @ <%= h @report.timestamp %></h3>
|
4
4
|
|
5
5
|
<dl class="group_details">
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'error_stalker/store/base'
|
2
|
+
require 'will_paginate/array'
|
2
3
|
require 'set'
|
3
4
|
|
4
5
|
# The simplest exception store. This just stores each reported
|
@@ -42,12 +43,12 @@ class ErrorStalker::Store::InMemory < ErrorStalker::Store::Base
|
|
42
43
|
def reports_in_group(digest)
|
43
44
|
exception_groups[digest]
|
44
45
|
end
|
45
|
-
|
46
|
+
|
46
47
|
# returns the exception group matching +digest+
|
47
48
|
def group(digest)
|
48
49
|
build_group_for_exceptions(reports_in_group(digest))
|
49
50
|
end
|
50
|
-
|
51
|
+
|
51
52
|
# Empty this exception store. Useful for tests!
|
52
53
|
def clear
|
53
54
|
@exceptions = []
|
@@ -55,7 +56,7 @@ class ErrorStalker::Store::InMemory < ErrorStalker::Store::Base
|
|
55
56
|
@machines = Set.new
|
56
57
|
@applications = Set.new
|
57
58
|
end
|
58
|
-
|
59
|
+
|
59
60
|
# Searches for exception reports maching +params+.
|
60
61
|
def search(params = {})
|
61
62
|
results = exceptions
|
@@ -82,14 +83,14 @@ class ErrorStalker::Store::InMemory < ErrorStalker::Store::Base
|
|
82
83
|
exception_groups.map do |digest, group|
|
83
84
|
data << build_group_for_exceptions(group)
|
84
85
|
end
|
85
|
-
|
86
|
+
|
86
87
|
data.reverse
|
87
88
|
end
|
88
|
-
|
89
|
+
|
89
90
|
def total
|
90
91
|
@exceptions.count
|
91
92
|
end
|
92
|
-
|
93
|
+
|
93
94
|
def total_since(timestamp)
|
94
95
|
@exceptions.select { |e| e.timestamp >= timestamp.to_s }.length
|
95
96
|
end
|
data/test/unit/client_test.rb
CHANGED
@@ -8,21 +8,21 @@ class ClientTest < Test::Unit::TestCase
|
|
8
8
|
@backend = ErrorStalker::Backend::InMemory.new
|
9
9
|
ErrorStalker::Client.backend = @backend
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def test_report
|
13
|
-
ErrorStalker::Client.report(:unit_test, new_exception, {
|
13
|
+
ErrorStalker::Client.report(:unit_test, new_exception, {"name" => "Bob"})
|
14
14
|
|
15
15
|
assert_equal 1, @backend.exceptions.length
|
16
16
|
exception_report = @backend.exceptions.first
|
17
17
|
assert_equal :unit_test, exception_report.application
|
18
18
|
assert_equal exception_report.send(:machine_name), exception_report.machine
|
19
19
|
assert_match "test/unit/client_test.rb:", exception_report.backtrace.first
|
20
|
-
assert_equal 'Bob', exception_report.data[
|
20
|
+
assert_equal 'Bob', exception_report.data["name"]
|
21
21
|
assert_equal 'NoMethodError', exception_report.type
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_report_exceptions_in_block
|
25
|
-
assert_raises NoMethodError do
|
25
|
+
assert_raises NoMethodError do
|
26
26
|
ErrorStalker::Client.report_exceptions(:unit_test) do
|
27
27
|
raise new_exception
|
28
28
|
end
|
@@ -49,7 +49,7 @@ class ClientTest < Test::Unit::TestCase
|
|
49
49
|
|
50
50
|
def test_dont_raise_exceptions_during_report
|
51
51
|
ErrorStalker::Client.backend = nil
|
52
|
-
|
52
|
+
|
53
53
|
assert_nothing_raised do
|
54
54
|
ErrorStalker::Client.report(:unit_test, new_exception, {:name => "Bob"})
|
55
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: error_stalker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-05-01 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Logs exceptions to a pluggable backend. Also provides a server for centralized
|
15
15
|
exception logging using a pluggable data store.
|
@@ -83,15 +83,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
hash: 1852610378218954238
|
86
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
90
|
none: false
|
88
91
|
requirements:
|
89
92
|
- - ! '>='
|
90
93
|
- !ruby/object:Gem::Version
|
91
94
|
version: '0'
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
hash: 1852610378218954238
|
92
98
|
requirements: []
|
93
99
|
rubyforge_project: error_stalker
|
94
|
-
rubygems_version: 1.8.
|
100
|
+
rubygems_version: 1.8.10
|
95
101
|
signing_key:
|
96
102
|
specification_version: 3
|
97
103
|
summary: Logs exceptions to a pluggable backend and/or a pluggable store
|