time_bandits 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/lib/time_bandits/monkey_patches/rails_rack_logger.rb +4 -5
- data/lib/time_bandits/version.rb +1 -1
- metadata +3 -18
@@ -5,7 +5,8 @@ module Rails
|
|
5
5
|
class Logger
|
6
6
|
|
7
7
|
def call(env)
|
8
|
-
start_time =
|
8
|
+
start_time = Time.now
|
9
|
+
before_dispatch(env, start_time)
|
9
10
|
result = @app.call(env)
|
10
11
|
ensure
|
11
12
|
run_time = Time.now - start_time
|
@@ -13,20 +14,18 @@ module Rails
|
|
13
14
|
end
|
14
15
|
|
15
16
|
protected
|
16
|
-
def before_dispatch(env)
|
17
|
+
def before_dispatch(env, start_time)
|
17
18
|
Thread.current[:time_bandits_completed_info] = nil
|
18
19
|
|
19
|
-
start_time = Time.now
|
20
20
|
request = ActionDispatch::Request.new(env)
|
21
21
|
path = request.fullpath
|
22
22
|
|
23
23
|
info "\n\nStarted #{request.request_method} \"#{path}\" " \
|
24
24
|
"for #{request.ip} at #{start_time.to_default_s}"
|
25
|
-
start_time
|
26
25
|
end
|
27
26
|
|
28
27
|
def after_dispatch(env, result, run_time)
|
29
|
-
status = result.first
|
28
|
+
status = result ? result.first : 500
|
30
29
|
duration, additions = Thread.current[:time_bandits_completed_info]
|
31
30
|
|
32
31
|
message = "Completed #{status} #{::Rack::Utils::HTTP_STATUS_CODES[status]} in %.1fms" % (run_time*1000)
|
data/lib/time_bandits/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time_bandits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 19
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 6
|
10
|
-
version: 0.0.6
|
5
|
+
version: 0.0.7
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Stefan Kaes
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-05 00:00:00 +02:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,10 +21,6 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - ~>
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 0
|
33
24
|
version: "3.0"
|
34
25
|
type: :runtime
|
35
26
|
version_requirements: *id001
|
@@ -76,23 +67,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
67
|
requirements:
|
77
68
|
- - ">="
|
78
69
|
- !ruby/object:Gem::Version
|
79
|
-
hash: 3
|
80
|
-
segments:
|
81
|
-
- 0
|
82
70
|
version: "0"
|
83
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
72
|
none: false
|
85
73
|
requirements:
|
86
74
|
- - ">="
|
87
75
|
- !ruby/object:Gem::Version
|
88
|
-
hash: 3
|
89
|
-
segments:
|
90
|
-
- 0
|
91
76
|
version: "0"
|
92
77
|
requirements: []
|
93
78
|
|
94
79
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.5.
|
80
|
+
rubygems_version: 1.5.3
|
96
81
|
signing_key:
|
97
82
|
specification_version: 3
|
98
83
|
summary: Custom performance logging for Rails
|