delayed-plugins-raven 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/delayed-plugins-raven/version.rb +1 -1
- data/lib/delayed-plugins-raven.rb +16 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cda5f840d2a0129ad193541ceaa61077d608223
|
4
|
+
data.tar.gz: 44df544fa078d48d1782fd0ba2c9cb9030f98cd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 711478e7cc792753ad50c4749de0a7e80fdf4203971c352cdb05570f494b46a45d97086eec1a158343b5aeaf5f9c75d98ea9bcc5b2b063b848a18624289eaf29
|
7
|
+
data.tar.gz: df16b8b2ec13322a84d1178850ab4d7e198979c7800fcf3f9f61a7b88c0104fabfe6b3973ded4a8d27cf9ef82a52b06cb70b521fd9da0a13b8163adad178f957
|
@@ -11,7 +11,7 @@ module Delayed::Plugins::Raven
|
|
11
11
|
begin
|
12
12
|
::Raven.capture_exception(error, {
|
13
13
|
configuration: ::Delayed::Plugins::Raven.configuration,
|
14
|
-
extra: { delayed_job: job
|
14
|
+
extra: { delayed_job: get_job_json(job) }
|
15
15
|
})
|
16
16
|
rescue Exception => e
|
17
17
|
Rails.logger.error "Raven logging failed: #{e.class.name}: #{e.message}"
|
@@ -19,6 +19,20 @@ module Delayed::Plugins::Raven
|
|
19
19
|
end
|
20
20
|
super if defined?(super)
|
21
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def get_job_json(job)
|
26
|
+
json = job.as_json["job"]
|
27
|
+
json["handler"] = trim_lines(json["handler"], ::Delayed::Plugins::Raven.max_handler_lines)
|
28
|
+
json["last_error"] = trim_lines(json["last_error"], ::Delayed::Plugins::Raven.max_error_lines)
|
29
|
+
json
|
30
|
+
end
|
31
|
+
|
32
|
+
def trim_lines(string, limit)
|
33
|
+
return string unless limit
|
34
|
+
string.lines.to_a.map(&:strip).slice(0, limit).join("\n") if string.present?
|
35
|
+
end
|
22
36
|
end
|
23
37
|
|
24
38
|
callbacks do |lifecycle|
|
@@ -32,6 +46,7 @@ module Delayed::Plugins::Raven
|
|
32
46
|
|
33
47
|
class << self
|
34
48
|
attr_accessor :configuration
|
49
|
+
attr_accessor :max_handler_lines, :max_error_lines
|
35
50
|
|
36
51
|
def configure
|
37
52
|
@configuration = ::Raven::Configuration.new
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed-plugins-raven
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Qiushi He
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-02-
|
13
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sentry-raven
|