bugsnag 1.0.5 → 1.0.6
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/VERSION +1 -1
- data/bugsnag.gemspec +1 -1
- data/lib/bugsnag/helpers.rb +13 -7
- data/lib/bugsnag/rack.rb +5 -4
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
data/bugsnag.gemspec
CHANGED
data/lib/bugsnag/helpers.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Bugsnag
|
2
2
|
module Helpers
|
3
3
|
def self.cleanup_hash(hash)
|
4
|
+
return nil unless hash
|
4
5
|
hash.inject({}) do |h, (k, v)|
|
5
6
|
h[k.to_s.gsub(/\./, "-")] = v.to_s
|
6
7
|
h
|
@@ -8,13 +9,14 @@ module Bugsnag
|
|
8
9
|
end
|
9
10
|
|
10
11
|
def self.apply_filters(hash, filters)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
return nil unless hash
|
13
|
+
return hash unless filters
|
14
|
+
|
15
|
+
hash.each do |k, v|
|
16
|
+
if filters.any? {|f| k.to_s.include?(f.to_s) }
|
17
|
+
hash[k] = "[FILTERED]"
|
18
|
+
elsif v.respond_to?(:to_hash)
|
19
|
+
apply_filters(hash[k])
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -22,5 +24,9 @@ module Bugsnag
|
|
22
24
|
def self.param_context(params)
|
23
25
|
"#{params[:controller]}##{params[:action]}" if params && params[:controller] && params[:action]
|
24
26
|
end
|
27
|
+
|
28
|
+
def self.request_context(request)
|
29
|
+
"#{request.request_method} #{request.path}" if request
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
data/lib/bugsnag/rack.rb
CHANGED
@@ -23,12 +23,13 @@ module Bugsnag
|
|
23
23
|
def bugsnag_request_data(env)
|
24
24
|
request = ::Rack::Request.new(env)
|
25
25
|
|
26
|
-
session = env[
|
27
|
-
params = env[
|
26
|
+
session = env["rack.session"]
|
27
|
+
params = env["action_dispatch.request.parameters"] || request.params
|
28
|
+
user_id = session[:session_id] || session["session_id"] if session
|
28
29
|
|
29
30
|
{
|
30
|
-
:user_id =>
|
31
|
-
:context => Bugsnag::Helpers.param_context(params),
|
31
|
+
:user_id => user_id,
|
32
|
+
:context => Bugsnag::Helpers.param_context(params) || Bugsnag::Helpers.request_context(request),
|
32
33
|
:meta_data => {
|
33
34
|
:request => {
|
34
35
|
:url => request.url,
|
metadata
CHANGED