whoops_rails_logger 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/whoops_rails_logger.rb +0 -2
- data/lib/whoops_rails_logger/exception_strategy.rb +10 -2
- data/lib/whoops_rails_logger/rack.rb +1 -1
- data/lib/whoops_rails_logger/railtie.rb +0 -1
- metadata +7 -9
- data/lib/whoops_rails_logger/action_controller_catcher.rb +0 -19
- data/lib/whoops_rails_logger/controller_methods.rb +0 -50
data/lib/whoops_rails_logger.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
require "digest"
|
2
2
|
require "whoops_logger"
|
3
|
-
require "whoops_rails_logger/action_controller_catcher"
|
4
|
-
require "whoops_rails_logger/controller_methods"
|
5
3
|
require "whoops_rails_logger/exception_strategy"
|
6
4
|
require "whoops_rails_logger/rack"
|
7
5
|
require "whoops_rails_logger/railtie"
|
@@ -27,8 +27,16 @@ module WhoopsRailsLogger
|
|
27
27
|
details[:backtrace] = exception.backtrace.collect{ |line|
|
28
28
|
line.sub(/^#{ENV['GEM_HOME']}/, '$GEM_HOME').sub(/^#{Rails.root}/, '$Rails.root')
|
29
29
|
}
|
30
|
-
|
31
|
-
|
30
|
+
|
31
|
+
details[:http_host] = rack_env["HTTP_HOST"]
|
32
|
+
details[:params] = rack_env["action_dispatch.request.parameters"]
|
33
|
+
details[:query_string] = rack_env["QUERY_STRING"]
|
34
|
+
details[:remote_addr] = rack_env["REMOTE_ADDR"]
|
35
|
+
details[:request_method] = rack_env["REQUEST_METHOD"]
|
36
|
+
details[:server_name] = rack_env["SERVER_NAME"]
|
37
|
+
details[:session] = rack_env["rack.session"]
|
38
|
+
details[:env] = ENV
|
39
|
+
message.details = details
|
32
40
|
end
|
33
41
|
|
34
42
|
self.add_message_builder(:create_event_group_identifier) do |message, raw_data|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whoops_rails_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Higginbotham
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-21 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - "="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 31
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
- 1
|
33
|
-
-
|
34
|
-
version: 0.1.
|
33
|
+
- 2
|
34
|
+
version: 0.1.2
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -145,8 +145,6 @@ extensions: []
|
|
145
145
|
extra_rdoc_files: []
|
146
146
|
|
147
147
|
files:
|
148
|
-
- lib/whoops_rails_logger/action_controller_catcher.rb
|
149
|
-
- lib/whoops_rails_logger/controller_methods.rb
|
150
148
|
- lib/whoops_rails_logger/evidence.rb
|
151
149
|
- lib/whoops_rails_logger/exception_strategy.rb
|
152
150
|
- lib/whoops_rails_logger/rack.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module WhoopsRailsLogger
|
2
|
-
module ActionControllerCatcher
|
3
|
-
# Sets up an alias chain to catch exceptions when Rails does
|
4
|
-
def self.included(base) #:nodoc:
|
5
|
-
# base.send(:alias_method, :rescue_action_in_public_without_whoops, :rescue_action_in_public)
|
6
|
-
# base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_whoops)
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
# Overrides the rescue_action method in ActionController::Base, but does not inhibit
|
12
|
-
# any custom processing that is defined with Rails 2's exception helpers.
|
13
|
-
def rescue_action_in_public_with_whoops(exception)
|
14
|
-
raw_data = {:exception => exception}.merge(whoops_request_data)
|
15
|
-
WhoopsRailsLogger.notify(raw_data)
|
16
|
-
rescue_action_in_public_without_whoops(exception)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module WhoopsRailsLogger
|
2
|
-
module ControllerMethods
|
3
|
-
private
|
4
|
-
|
5
|
-
# This method should be used for sending manual notifications while you are still
|
6
|
-
# inside the controller. Otherwise it works like WhoopsLoggerRails.notify.
|
7
|
-
def notify_whoops(exception)
|
8
|
-
raw_data = {:exception => exception}.merge(whoops_request_data)
|
9
|
-
WhoopsRailsLogger.notify(:rails, raw_data)
|
10
|
-
end
|
11
|
-
|
12
|
-
def whoops_request_data
|
13
|
-
{ :parameters => whoops_filter_if_filtering(params.to_hash),
|
14
|
-
:session_data => whoops_filter_if_filtering(whoops_session_data),
|
15
|
-
:controller => params[:controller],
|
16
|
-
:action => params[:action],
|
17
|
-
:url => whoops_request_url,
|
18
|
-
:cgi_data => whoops_filter_if_filtering(request.env) }
|
19
|
-
end
|
20
|
-
|
21
|
-
def whoops_filter_if_filtering(hash)
|
22
|
-
return hash if ! hash.is_a?(Hash)
|
23
|
-
|
24
|
-
if respond_to?(:filter_parameters)
|
25
|
-
filter_parameters(hash) rescue hash
|
26
|
-
else
|
27
|
-
hash
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def whoops_session_data
|
32
|
-
if session.respond_to?(:to_hash)
|
33
|
-
session.to_hash
|
34
|
-
else
|
35
|
-
session.data
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def whoops_request_url
|
40
|
-
url = "#{request.protocol}#{request.host}"
|
41
|
-
|
42
|
-
unless [80, 443].include?(request.port)
|
43
|
-
url << ":#{request.port}"
|
44
|
-
end
|
45
|
-
|
46
|
-
url << request.request_uri
|
47
|
-
url
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|