lograge 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lograge.rb +14 -11
- data/lib/lograge/log_subscriber.rb +2 -0
- data/lib/lograge/version.rb +1 -1
- data/spec/lograge_logsubscriber_spec.rb +7 -0
- metadata +10 -10
data/lib/lograge.rb
CHANGED
@@ -25,20 +25,23 @@ module Lograge
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.remove_existing_log_subscriptions
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
|
29
|
+
case subscriber
|
30
|
+
when ActionView::LogSubscriber
|
31
|
+
unsubscribe(:action_view, subscriber)
|
32
|
+
when ActionController::LogSubscriber
|
33
|
+
unsubscribe(:action_controller, subscriber)
|
34
|
+
end
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
|
-
def self.
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
def self.unsubscribe(component, subscriber)
|
39
|
+
events = subscriber.public_methods(false).reject{ |method| method.to_s == 'call' }
|
40
|
+
events.each do |event|
|
41
|
+
ActiveSupport::Notifications.notifier.listeners_for("#{event}.#{component}").each do |listener|
|
42
|
+
if listener.instance_variable_get('@delegate') == subscriber
|
43
|
+
ActiveSupport::Notifications.unsubscribe listener
|
44
|
+
end
|
42
45
|
end
|
43
46
|
end
|
44
47
|
end
|
data/lib/lograge/version.rb
CHANGED
@@ -79,6 +79,13 @@ describe Lograge::RequestLogSubscriber do
|
|
79
79
|
log_output.string.should =~ /error='AbstractController::ActionNotFound:Route not found'/
|
80
80
|
end
|
81
81
|
|
82
|
+
it "should return an unknown status when no status or exception is found" do
|
83
|
+
event.payload[:status] = nil
|
84
|
+
event.payload[:exception] = nil
|
85
|
+
subscriber.process_action(event)
|
86
|
+
log_output.string.should =~ /status=0/
|
87
|
+
end
|
88
|
+
|
82
89
|
describe "with a redirect" do
|
83
90
|
before do
|
84
91
|
Thread.current[:lograge_location] = "http://www.example.com"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lograge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70342810146560 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70342810146560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: guard-rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70342810146040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70342810146040
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activesupport
|
38
|
-
requirement: &
|
38
|
+
requirement: &70342810145560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70342810145560
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: actionpack
|
49
|
-
requirement: &
|
49
|
+
requirement: &70342810144900 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70342810144900
|
58
58
|
description: Tame Rails' multi-line logging into a single line per request
|
59
59
|
email:
|
60
60
|
- meyer@paperplanes.de
|