rescue_tracer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +30 -0
- data/Rakefile +1 -0
- data/lib/rescue_tracer/railtie.rb +7 -0
- data/lib/rescue_tracer/traceable.rb +28 -0
- data/lib/rescue_tracer/version.rb +3 -0
- data/lib/rescue_tracer.rb +15 -0
- data/rescue_tracer.gemspec +22 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9affd2a3a0ece51b4c9d3fe2f2ec0a9cd1529872
|
4
|
+
data.tar.gz: 67ad04b9eb75172d03d0587371bc744eb9ee2f37
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 62899be23642e9b5842c81ae62ef28994113a561f67778f8467f9bab58edb527ef64cb22155a2de081a9e06bde49f54b56a8e95774768304b5b2f2524575e756
|
7
|
+
data.tar.gz: 9e95cbe5fc8fe2bc8d8cb4034c6938d0762ba6da11146d3785c994eab28f0730de1287cd1df033917b4b5d5e91f141b935be06617861ee0e06ea73f5830a2ad9
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ryo Nakamura
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# RescueTracer
|
2
|
+
Log backtrace when rescue_from is called.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
```ruby
|
6
|
+
group :test do
|
7
|
+
gem "rescue_tracer"
|
8
|
+
end
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
Enable at spec/spec_helper.rb
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
RescueTracer.enable!
|
16
|
+
```
|
17
|
+
|
18
|
+
When `rescue_from` catches any exception, it logs the exception's information to Rails.logger.
|
19
|
+
|
20
|
+
```
|
21
|
+
Started GET "/recipes" for 127.0.0.1 at 2014-01-21 17:17:57 +0900
|
22
|
+
Processing by RecipesController#show as HTML
|
23
|
+
Recipes Load (0.4ms) SELECT id FROM `recipes` WHERE `recipes`.`user_id` = '1'
|
24
|
+
RuntimeError
|
25
|
+
/Users/r7kamura/example/app/controllers/recipess_controller.rb:20:in `show'
|
26
|
+
/Users/r7kamura/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
|
27
|
+
/Users/r7kamura/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/abstract_controller/base.rb:189:in `process_action'
|
28
|
+
/Users/r7kamura/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_controller/metal/rendering.rb:10:in `process_action'
|
29
|
+
...
|
30
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module RescueTracer
|
2
|
+
module Traceable
|
3
|
+
def rescue_with_handler(exception)
|
4
|
+
Rails.logger.debug(ExceptionView.new(exception)) if RescueTracer.enabled?
|
5
|
+
super
|
6
|
+
end
|
7
|
+
|
8
|
+
class ExceptionView
|
9
|
+
def initialize(exception)
|
10
|
+
@exception = exception
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_s
|
14
|
+
"#{summary}\n#{backtrace}"
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def summary
|
20
|
+
"#{@exception.class} #@exception"
|
21
|
+
end
|
22
|
+
|
23
|
+
def backtrace
|
24
|
+
@exception.backtrace.join("\n")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rescue_tracer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rescue_tracer"
|
8
|
+
spec.version = RescueTracer::VERSION
|
9
|
+
spec.authors = ["Ryo Nakamura"]
|
10
|
+
spec.email = ["r7kamura@gmail.com"]
|
11
|
+
spec.summary = "Log backtrace when rescue_from is called."
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rescue_tracer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryo Nakamura
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- r7kamura@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/rescue_tracer.rb
|
54
|
+
- lib/rescue_tracer/railtie.rb
|
55
|
+
- lib/rescue_tracer/traceable.rb
|
56
|
+
- lib/rescue_tracer/version.rb
|
57
|
+
- rescue_tracer.gemspec
|
58
|
+
homepage: ''
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.0.3
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: Log backtrace when rescue_from is called.
|
82
|
+
test_files: []
|