crashlog 1.0.2.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/crash_log.rb +5 -2
- data/lib/crash_log/configuration.rb +4 -5
- data/lib/crash_log/payload.rb +4 -1
- data/lib/crash_log/rails.rb +3 -3
- data/lib/crash_log/reporter.rb +9 -4
- data/lib/crash_log/version.rb +1 -1
- data/lib/crashlog.rb +1 -1
- metadata +16 -16
data/lib/crash_log.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
$: << File.expand_path('..', __FILE__)
|
2
2
|
|
3
3
|
require 'crash_log/version'
|
4
|
+
|
4
5
|
begin
|
5
6
|
require 'active_support'
|
6
7
|
require 'active_support/core_ext'
|
@@ -8,10 +9,11 @@ rescue LoadError
|
|
8
9
|
require 'activesupport'
|
9
10
|
require 'activesupport/core_ext'
|
10
11
|
end
|
12
|
+
|
11
13
|
require 'faraday'
|
12
14
|
require 'multi_json'
|
13
|
-
require 'crash_log/railtie' if defined?(Rails::Railtie)
|
14
15
|
|
16
|
+
require 'crash_log/railtie' if defined?(Rails::Railtie)
|
15
17
|
require 'crash_log/logging'
|
16
18
|
|
17
19
|
module CrashLog
|
@@ -70,7 +72,8 @@ module CrashLog
|
|
70
72
|
|
71
73
|
# Print a message at the top of the applciation's logs to say we're ready.
|
72
74
|
def report_for_duty!
|
73
|
-
|
75
|
+
self.reporter = CrashLog::Reporter.new(configuration)
|
76
|
+
application = reporter.announce
|
74
77
|
|
75
78
|
if application
|
76
79
|
info("Configured correctly and ready to handle exceptions for '#{application}'")
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'hashr'
|
2
2
|
require 'multi_json'
|
3
|
-
|
4
3
|
module CrashLog
|
5
4
|
class Configuration < Hashr
|
6
5
|
DEFAULT_PARAMS_FILTERS = %w(password password_confirmation).freeze
|
@@ -9,21 +8,21 @@ module CrashLog
|
|
9
8
|
DEFAULT_BACKTRACE_FILTERS = [
|
10
9
|
lambda { |line|
|
11
10
|
if defined?(CrashLog.configuration.root) &&
|
12
|
-
CrashLog.configuration.root.to_s != ''
|
11
|
+
CrashLog.configuration.root.to_s != '' && line
|
13
12
|
line.sub(/#{CrashLog.configuration.root}/, "[PROJECT_ROOT]")
|
14
13
|
else
|
15
14
|
line
|
16
15
|
end
|
17
16
|
},
|
18
|
-
lambda { |line| line.gsub(/^\.\//, "") },
|
17
|
+
lambda { |line| line && line.gsub(/^\.\//, "") },
|
19
18
|
lambda { |line|
|
20
|
-
if defined?(Gem)
|
19
|
+
if defined?(Gem) && line
|
21
20
|
Gem.path.inject(line) do |line, path|
|
22
21
|
line.gsub(/#{path}/, "[GEM_ROOT]")
|
23
22
|
end
|
24
23
|
end
|
25
24
|
},
|
26
|
-
lambda { |line| line if line !~ %r{lib/crash_log} }
|
25
|
+
lambda { |line| line if line && line !~ %r{lib/crash_log} }
|
27
26
|
].freeze
|
28
27
|
|
29
28
|
IGNORE_DEFAULT = ['ActiveRecord::RecordNotFound',
|
data/lib/crash_log/payload.rb
CHANGED
@@ -38,6 +38,8 @@ module CrashLog
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def deliver
|
41
|
+
error("Not configured, please run CrashLog.configure") && return unless reporter
|
42
|
+
|
41
43
|
if reporter.notify(self.body)
|
42
44
|
reporter.result
|
43
45
|
end
|
@@ -84,7 +86,8 @@ module CrashLog
|
|
84
86
|
def notifier
|
85
87
|
{
|
86
88
|
:name => "crashlog",
|
87
|
-
:version => CrashLog::VERSION
|
89
|
+
:version => CrashLog::VERSION,
|
90
|
+
:language => 'Ruby'
|
88
91
|
}
|
89
92
|
end
|
90
93
|
|
data/lib/crash_log/rails.rb
CHANGED
@@ -20,10 +20,10 @@ module CrashLog
|
|
20
20
|
end
|
21
21
|
|
22
22
|
CrashLog.configure(true) do |config|
|
23
|
-
config.logger
|
24
|
-
config.stage
|
23
|
+
config.logger = rails_logger
|
24
|
+
config.stage = RAILS_ENV if defined?(RAILS_ENV)
|
25
25
|
config.project_root = RAILS_ROOT if defined?(RAILS_ROOT)
|
26
|
-
config.framework
|
26
|
+
config.framework = "Rails: #{::Rails::VERSION::STRING}" if defined?(::Rails::VERSION)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/crash_log/reporter.rb
CHANGED
@@ -43,9 +43,9 @@ module CrashLog
|
|
43
43
|
return if dry_run?
|
44
44
|
return "Unknown application" unless announce_endpoint
|
45
45
|
|
46
|
-
response = post(config.announce_endpoint,
|
46
|
+
response = post(config.announce_endpoint, MultiJson.encode({:payload => identification_hash}))
|
47
47
|
if response.status == 201
|
48
|
-
|
48
|
+
MultiJson.load(response.body).symbolize_keys.fetch(:application_name, 'Default')
|
49
49
|
else
|
50
50
|
nil
|
51
51
|
end
|
@@ -55,7 +55,7 @@ module CrashLog
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def report_result(body)
|
58
|
-
@result =
|
58
|
+
@result = MultiJson.load(body).symbolize_keys
|
59
59
|
end
|
60
60
|
|
61
61
|
def url
|
@@ -65,7 +65,12 @@ module CrashLog
|
|
65
65
|
def identification_hash
|
66
66
|
{
|
67
67
|
:hostname => SystemInformation.hostname,
|
68
|
-
:timestamp => Time.now.utc.to_i
|
68
|
+
:timestamp => Time.now.utc.to_i,
|
69
|
+
:notifier => {
|
70
|
+
:name => "crashlog",
|
71
|
+
:version => CrashLog::VERSION,
|
72
|
+
:language => 'Ruby'
|
73
|
+
}
|
69
74
|
}
|
70
75
|
end
|
71
76
|
|
data/lib/crash_log/version.rb
CHANGED
data/lib/crashlog.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "crash_log"
|
1
|
+
require File.expand_path("../crash_log", __FILE__)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crashlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70343404183900 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70343404183900
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: faraday
|
27
|
-
requirement: &
|
27
|
+
requirement: &70343404199760 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.8.4
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70343404199760
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: multi_json
|
38
|
-
requirement: &
|
38
|
+
requirement: &70343404199260 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.3.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70343404199260
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: crashlog-auth-hmac
|
49
|
-
requirement: &
|
49
|
+
requirement: &70343404198800 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.1.6
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70343404198800
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rabl
|
60
|
-
requirement: &
|
60
|
+
requirement: &70343404198340 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.6.14
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70343404198340
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: uuid
|
71
|
-
requirement: &
|
71
|
+
requirement: &70343404197960 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70343404197960
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: hashr
|
82
|
-
requirement: &
|
82
|
+
requirement: &70343404197500 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70343404197500
|
91
91
|
description: CrashLog Exception reporter
|
92
92
|
email:
|
93
93
|
- support@crashlog.io
|